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