Skip to content

Instantly share code, notes, and snippets.

View cmather's full-sized avatar

Chris Mather cmather

  • Elements
  • California
View GitHub Profile
@cmather
cmather / getViewportSize.js
Created March 18, 2012 19:14 — 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;";