window.onscroll = function() { if (document.body.scrollTop + window.innerHeight == document.body.offsetHeight) { alert('end'); } }