/**
* 获取浏览器可视区域宽度
*/
function getViewPortOffset() {
if (window.innerWidth) {
return {
w: window.innerWidth,
h: window.innerHeight
}
} else if (document.compatMode = "BackCompat") {
return {
w: document.body.clientWidth,
h: document.body.clientHeigth
}
} else {
return {
w: document.documentElement.clientWidth,
h: document.documentElement.clientHeight
}
}
}
console.log(getViewPortOffset());
热门推荐:
0