js 獲取窗口大小

 //得到窗口大小
        function findDimensions() //函數:獲取尺寸
        {
            var point = {};
            //獲取窗口寬度
            window.innerWidth && (point.width = window.innerWidth);
            window.innerHeight && (point.height = window.innerHeight);
            /*       
                        //document.body.clientWidth   網頁可見區域寬
            //document.body.clientHeight   網頁可見區域高:
                        //document.body.clientWidth;
            //document.documentElement.clientHeight
                  document.body.clientWidth && (point.width = document.body.clientWidth);
                        document.body.clientHeight && (point.height =document.body.clientHeight); */

            //winHeight = document.body.clientHeight;

            return point;
        }
相關文章
相關標籤/搜索