获取浏览器窗口大小

前端之家收集整理的这篇文章主要介绍了获取浏览器窗口大小前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<table class="html5"><tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

>     function size(){         var w = 0,h=0;           if(!window.innerWidth){             w = (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth);               h = (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight);         }else{             w = window.innerWidth;             h = window.innerHeight;         }         return {width:w,height:h};     }       console.log(size());//Object { width: 1366,height: 633 } >  

猜你在找的程序笔记相关文章