Viewport dimensions | Javascript

1
2
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Viewport Size In JavaScript.

jsFiddle example - https://jsfiddle.net/6uoLsupv/
The example will take the botom-right window which is an iframe, that is why the values are smaller than your browser's viewport.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.