1function getDocHeight() { // $(document).height() value depends on browser
2 var D = document;
3 return Math.max(
4 D.body.scrollHeight, D.documentElement.scrollHeight,
5 D.body.offsetHeight, D.documentElement.offsetHeight,
6 D.body.clientHeight, D.documentElement.clientHeight
7 );
8}
9$(window).scroll(function() {
10 if($(window).scrollTop() + $(window).height() == getDocHeight()) {
11 alert("bottom!");
12 }
13});
1function scrolled(e) {
2 if (myDiv.offsetHeight + myDiv.scrollTop >= myDiv.scrollHeight) {
3 scrolledToBottom(e);
4 }
5}
6
1window.onscroll = function(ev) {
2 if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
3 // you're at the bottom of the page
4 }
5};