/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var viewportWidth; var viewportHeight; if(window.innerWidth) { // normal browsers (incl. scrollbars) viewportWidth = window.innerWidth; viewportHeight = window.innerHeight; } else { // IE (and all other browsers ... minus the scrollbar(s)) viewportWidth = document.documentElement.clientWidth; viewportHeight = document.documentElement.clientHeight; }