/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// found at http://stackoverflow.com/questions/871399/cross-browser-method-for-detecting-the-scrolltop-of-the-browser-window function getScrollTop(){ if(typeof pageYOffset!= 'undefined'){ //most browsers return pageYOffset; } else{ var B= document.body; //IE 'quirks' var D= document.documentElement; //IE with doctype D= (D.clientHeight)? D: B; return D.scrollTop; } }