Call function at the end of the scroll

I want to call a specific function when the scroll reaches the bottom of the page.

Here is my m code, but it does not work for me. There are no errors in the console, but still does not work.

$(function() { var scrollEnded = $.debounce(500, false, function() { console.log('scroll ended'); alert("ok"); // I will call my function here. Just need an alert. }); }); 
+4
source share
1 answer

Try this feature

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

Check JSFIDDLE

+4
source

Source: https://habr.com/ru/post/1501251/


All Articles