JSFiddle - React, Tailwind, and code Playground
by JInks Peng
JavaScript
function size() {
var wdth = 0;
var hth = 0;
if(!window.innerWidth) { //IE
wdth = (document.documentElement.clientWidth ?
document.documentElement.clientWidth :
document.body.clientWidth);
hth = (document.documentElement.clientHeight ?
document.documentElement.clientHeight :
document.body.clientHeight);
} else { //other
wdth = window.innerWidth;
hth = window.innerHeight;
}
alert('width: ' + wdth + '; height: ' + hth);
}
size();