function getViewport(){
if (document.compatMode == "BackCompat"){
return {
document.body.clientWidth,
height: document.body.clientHeight
}
} else {
return {
document.documentElement.clientWidth,
height: document.documentElement.clientHeight
}
}
}
//js 获取元素位置方法 getBoundingClientRect()