Skip to content Skip to sidebar Skip to footer

How Do I Use Jquery To Detect If A User Scrolls To The Bottom Of The Page?

And once it hits the bottom,then have a callback function?

Solution 1:

You can use .scroll() event in this way on your window:

$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() == $(document).height()) {
       alert("bottom!");
   }
});

check live demo

to detect if the user is 3/4 down the page you can try this one

$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() > $(document).height() - .75*$(document).height()) {
       alert("3/4th of bottom!");
   }
});

Post a Comment for "How Do I Use Jquery To Detect If A User Scrolls To The Bottom Of The Page?"