首页 > Web开发 > 详细

JS 获取浏览器窗口大小方面的

时间:2014-02-28 09:20:36      阅读:516      评论:0      收藏:0      [点我收藏+]

function getDocument() {
        var de = document.documentElement;
        var body = {
            clientWidth: self.innerWidth || (de && de.clientWidth) || document.body.clientWidth, //只得到页面可见宽
            clientHeight: self.innerHeight || (de && de.clientHeight) || document.body.clientHeight, //只得到页面可见高
            scrollTop: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 //页面被卷上去的高度
        };
        return body;
    }

 

针对IE的滤镜样式

 

浮动最上层

position:fixed; _position:absolute; left:0; top:0;

_top:expression(window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);

 

浮动居中

position:fixed; _position:absolute; margin:-130px 0 0 -280px; left:50%; top:50%;

_top:expression((window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop)+(document.documentElement.clientHeight||document.body.clientHeight)/2);

JS 获取浏览器窗口大小方面的,布布扣,bubuko.com

JS 获取浏览器窗口大小方面的

原文:http://www.cnblogs.com/RedRoshan/p/3571555.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!