javascript - I am applying an ajax when the user scrolled to bottom of the screen but the ajax is keep firing even when the user is at the bottom -
following code using fetch data ajax when user reaches near bottom of page.
$(window).scroll(function() { if($(window).scrolltop() + $(window).height() > $(document).height() - 300) { alert("near bottom!");//this place ajax being applied } });
the above code triggering alert function couple of times. when scrolling bact top alert function triggers.
Comments
Post a Comment