获取屏幕可视区域封装

client:function(){
    if (window.innerWidth !== null) {//最高浏览器
	return{
	    "width":window.innerWidth,
	    "height":window.innerHeight
	}
    }else if (document.compatMode ==="CSS1Compat") {//W3C
        return{
            "width":document.documentElement.clientWidth,	
	    "height":document.documentElement.clientHeight
	}
    }
    return{
	"width":document.body.clientWidth,
	"height":document.body.clientHeight
    }
}
发布了72 篇原创文章 · 获赞 5 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qzcrystal/article/details/104155884
今日推荐