//求可视区窗口的尺寸
window.innerWidth
window.innerHeight
window.innerWidth = width + padding + border + 纵向滚动条宽度
window.innerHeight = height + padding + border + 横向滚动条高度
//IE8以下
document.body.clientWidth(怪异模式)/document.documentElement.clientWidth(标准模式)
document.compatMode//检查是什么模式
backCompat//向后兼容 怪异模式
function getViewOffset(){
if(window.innerWidth){
return{
w:window.innerWidth,
h:window.innerHeight
}
}else{
if(document.compatMode==='BackMode'){
return{
w:document.body.clientWidth,
h:document.body.clientHeight
}
}else{
return{
w:document.documentElement.clientWidth,
h:document.documentElement.clientHeight
}
}
}
}