Created
June 8, 2018 07:48
-
-
Save jorgeortega/fd3292bdcd7be0b49a9bc97f6a34bc25 to your computer and use it in GitHub Desktop.
Get viewport dimension
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
export function getViewportDimensions () { | |
const w = window | |
const d = document | |
const e = d.documentElement | |
const g = d.getElementsByTagName('body')[0] | |
const x = w.innerWidth || e.clientWidth || g.clientWidth | |
const y = w.innerHeight || e.clientHeight || g.clientHeight | |
return { x, y } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment