Skip to content

Instantly share code, notes, and snippets.

@bgaze
bgaze / vanilla-js-window-size.js
Last active September 2, 2019 10:47 — forked from joshcarr/window-height-width.js
[Vanilla JS] Get window dimensions
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
};
};