Skip to content

Instantly share code, notes, and snippets.

@arozwalak
Last active March 9, 2017 21:54
Show Gist options
  • Save arozwalak/9fa067751a6a68e5bab5 to your computer and use it in GitHub Desktop.
Save arozwalak/9fa067751a6a68e5bab5 to your computer and use it in GitHub Desktop.
Javascript: viewport width and height
function viewport () {
var e = window, a = 'inner';
if (!('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment