4

I want to call a specific function when the Scroll reaches at the Bottom END of the page.

Here is my Code m using but its not working for me. No console errors, but still not working.

$(function() {

    var scrollEnded = $.debounce(500, false, function() {

    console.log('scroll ended');

           alert("ok"); // I will call my function here. Just need an alert.

    });

});
Sathyajith Bhat
  • 20,587
  • 21
  • 94
  • 129
Hassan Sardar
  • 4,153
  • 16
  • 53
  • 91

1 Answers1

4

Try this function

$(function(){
   $(window).scroll(function(){
       if($(document).height()==$(window).scrollTop()+$(window).height()){
           alert('I am at the bottom');
           // Here goes your code.
       }
   });
});

Check this JSFIDDLE

Umang Mehta
  • 1,417
  • 11
  • 16