Skip to content

Instantly share code, notes, and snippets.

@janantala
janantala / getViewportSize.js
Created March 16, 2012 19:51 — forked from scottjehl/getViewportSize.js
Reliably get viewport dimensions in JS
/*!
An experiment in getting accurate visible viewport dimensions across devices
(c) 2012 Scott Jehl.
MIT/GPLv2 Licence
*/
function viewportSize(){
var test = document.createElement( "div" );
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;";