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});