Get the page width and height of the visible region, sub-total three ways under different circumstances:
Viewing area: the current browser window visible part, does not include scrollable area.
Method One: IE9 IE9 browser and above
Use innerWidth, innerHeight can acquire the width and height of the visible area of the page
console.log(window.innerWidth);//可视区域的宽
console.log(window.innerHeight);//可视区域的高
Method Two: standard mode (high or low all browsers)
There are two modes in the browser when rendering the page: "Standard mode (CSS1Compat)", the case is in standard mode to render the "promiscuous mode / quirks mode (BackCompat)" by default.
If the page is not in accordance with written documentation states that it will "promiscuous mode / quirks mode" to render
Use document.documentElement.clientWidth, document.documentElement.clientHeight can acquire the width and height of the visible area of the page
console.log(document.documentElement.clientWidth);
console.log(document.documentElement.clientHeight);
Method three: promiscuous
console.log(document.body.clientWidth, document.body.clientHeight);