取不同浏览器可视区域宽高方法

function getViewportOffset(){
if(window.innerWidth){
return {
w:window.innerWidth,
t:window.innerHeight
}
}else if(document.compatMode == "BackCompat"){
return {
w:document.body.clientWidth,
t:document.body.clientHeight
}
}else{

return {
w:document.documentElement.clientWidth,
t:document.documentElement.clientHeight
}
}
}
posted @ 2018-10-05 19:06  风的方向·  阅读(163)  评论(0编辑  收藏  举报