-
-
Save bgaze/5c81b793c265b3b687ef38ddd9a032f2 to your computer and use it in GitHub Desktop.
[Vanilla JS] Get window dimensions
This file contains hidden or 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
const windowSize = () => { | |
let body = document.getElementsByTagName('body')[0]; | |
return { | |
width: window.innerWidth || document.documentElement.clientWidth || body.clientWidth, | |
height: window.innerHeight || document.documentElement.clientHeight || body.clientHeight | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment