Posted By

madr on 12/15/10


Tagged

javascript textmate crossbrowser DOM independent


Versions (?)

Cross browser scrollTop


 / Published in: Other
 

  1. // found at http://stackoverflow.com/questions/871399/cross-browser-method-for-detecting-the-scrolltop-of-the-browser-window
  2. function getScrollTop(){
  3. if(typeof pageYOffset!= 'undefined'){
  4. //most browsers
  5. return pageYOffset;
  6. }
  7. else{
  8. var B= document.body; //IE 'quirks'
  9. var D= document.documentElement; //IE with doctype
  10. D= (D.clientHeight)? D: B;
  11. return D.scrollTop;
  12. }
  13. }

Report this snippet  

You need to login to post a comment.