Is there a way to find out page end using Jquery, so that a simple message can be displayed saying you have reached end of the page.
To avoid duplicate console.log('end of page')
, you need create a setTimeout, like this:
var doc = $(document), w = $(window), timer;
doc.on('scroll', function(){
if(doc.scrollTop() + w.height() >= doc.height()){
if(typeof timer !== 'undefined') clearTimeout(timer);
timer = setTimeout(function(){
console.log('end of page');
}, 50);
}
});