JQuery if function $ (window) scroll down

hello I need when $(window)scrolling with 100%alert something how can I do this?

+4
source share
3 answers

Try:

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

Demo

+4
source

I used something like this once :)

   if($(window).scrollTop() + $(window).height() > $(document).height() - 50) {
                       //alert
}

Just play with the numbers, this one is built in to display a warning almost until the end of the scroll

+3
source

Try this. When you scroll the page, and if the page is reached to the bottom, then a warning message will appear.

$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() == $(document).height()) {
       alert("Bottom Reached!");
   }
});
+3
source

All Articles