Posted By

devnull69 on 07/06/11


Tagged

width height viewport innerWidth clientWidth


Versions (?)

Browser dependent viewport size


 / Published in: JavaScript
 

  1. var viewportWidth;
  2. var viewportHeight;
  3. if(window.innerWidth) {
  4. // normal browsers (incl. scrollbars)
  5. viewportWidth = window.innerWidth;
  6. viewportHeight = window.innerHeight;
  7. } else {
  8. // IE (and all other browsers ... minus the scrollbar(s))
  9. viewportWidth = document.documentElement.clientWidth;
  10. viewportHeight = document.documentElement.clientHeight;
  11. }

Report this snippet  

You need to login to post a comment.