Posted By


uberdragon on 05/10/11

Tagged


Statistics


Viewed 99 times
Favorited by 0 user(s)

getScrollHeight()


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getScrollHeight() {
  2. var maxDisplacement=0;
  3.  
  4. window.scrollTo(0,10000000);
  5.  
  6. if( typeof self.pageYOffset!='undefined' )
  7. maxDisplacement=self.pageYOffset;
  8. else if( document.compatMode && document.compatMode != 'BackCompat' )
  9. maxDisplacement=document.documentElement.scrollTop ;
  10. else if( document.body && typeof(document.body.scrollTop)!='undefined' )
  11. maxDisplacement=document.body.scrollTop;
  12.  
  13. window.scrollTo(0,0);
  14. return maxDisplacement;
  15. }
  16.  
  17. window.onload=function(){
  18. var h = getScrollHeight();
  19. alert(h);
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.