javascript - setTimeout() is not working as it should be -
i need able wait amount of time when scroll event occurs.
code:
$(window).scroll(function() { if($(window).scrolltop() + $(window).height() == $(document).height()) { settimeout(function (){}, 1000); //i need able wait 1 second , continue execution... $(".loader").show().delay(700).fadeout(); $.ajax({ ///more code }); } }); any idea wrong?
why settimeout() doesn't work in particular example?
settimeout() non-blocking. move code should happen later empty function.
settimeout(function (){ $(".loader").show().delay(700).fadeout(); $.ajax({ /* more code */ }); }, 1000);
Comments
Post a Comment