I have this code.
$(document).ready(function() {
$('#box').hide();
$(window).bind('scroll', function(){
if($(this).scrollTop() > 200) {
$("#box").fadeIn(300);
}
else {
$("#box").fadeOut(300);
}
});
});
So when I scroll down 200px it will make a div appear. When I scroll back up, it will disappear. This is fine, until I do it a lot.
If I scroll up and down like a nutter the div keeps fading in and out even after I stop. This isn’t related to just this instance, it’s happened a lot in the past and I’ve always wanted to know how to fix it (by making it stop as soon as I have, without doing it for everytime I scrolled up and down).
Is that possible?
.clearQueue() worked much better than .stop()