javascript获得浏览器工作区域的大小

浏览器的窗口发生变化时会执行window.onresize方法,通过这个方法我们可以获得到浏览器工作区域的大小:

1 window.onresize=function(){ 
2     bodyHeight = window.innerHeight?(window.innerHeight<600?600:window.innerHeight):document.documentElement.clientHeight;
3     bodyWidth = window.innerWidth?window.innerWidth:document.body.offsetWidth;
4 };
原文地址:https://www.cnblogs.com/smallrock/p/3656935.html