jquery - How to add a callback with scrolltop and animate -
for ie8 use code uses jquery animate banner @ bottom of page when user scrolls 250 or more. problem extremely slow , has huge delay, believe because animate event firing many times, need callback written in .stop(); i'm not sure how/where put this. ideas?
} else { $(window).scroll(function() { if ($(this).scrolltop() < 250) { if($("#carriage-promo").not(':animated')){ $("#carriage-promo").animate({ height: 0 },100); } } else { if($("#carriage-promo").not(':animated')){ $("#carriage-promo").animate({ height: '40px' },100); } } }); }
try this:
$(window).scroll(function() { if ($(this).scrolltop() < 250) { if($("#carriage-promo").not(':animated')){ $("#carriage-promo").stop(true,true).animate({ height: 0 },100); } } else { if($("#carriage-promo").not(':animated')){ $("#carriage-promo").stop(true,true).animate({ height: '40px' },100); } } });
Comments
Post a Comment