Skip to content

Instantly share code, notes, and snippets.

@pixiebox
Created October 23, 2016 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixiebox/8e333aee5d33a7ce9c5f052230d8f8d2 to your computer and use it in GitHub Desktop.
Save pixiebox/8e333aee5d33a7ce9c5f052230d8f8d2 to your computer and use it in GitHub Desktop.
function viewport() {
var el = window,
attr = 'inner';
if (!('innerWidth' in window )) {
attr = 'client';
el = document.documentElement || document.body;
}
return {
width : el[attr + 'Width'],
height : el[attr + 'Height']
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment