Created
October 23, 2016 10:18
-
-
Save pixiebox/8e333aee5d33a7ce9c5f052230d8f8d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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