I want to alert something when the scroll reaches the BOTTOM of the page, like this:
$(function(){
$(document).scroll(function() {
if($(document).scrol
if(window.addEventListener){
window.addEventListener('scroll',scroll)
}else if(window.attachEvent){
window.attachEvent('onscroll',scroll);
}
function scroll(ev){
var st = Math.max(document.documentElement.scrollTop,document.body.scrollTop);
if(!st){
console.log('top');
}else if((st+document.documentElement.clientHeight)>=document.documentElement.scrollHeight ){
console.log('bottom');
}
}
example: http://jsfiddle.net/ampersand/AEnzJ/
tested with http://browserling.com in chrome 17/18, safari 5, ff 10/11.0, ie 7-9