获取视口宽高
function getVierPortOffset(){
if(window.innerWidth){
return {
w:window.innerWidth,
h:window.innerHeight,
}
}else{
//浏览器怪异模式
if(document.compatMode === 'BackCompat'){
return {
w:document.body.clientWidth,
h:document.body.clientHeight,
}
}else{
return {
w:document.documentElement.clientWidth,
h:document.documentElement.clientHeight,
}
}
}
}
获取元素宽高
function getStyle(elem,prop){
if(window.getComputedStyle){
return window.getComputedStyle(elem,null)[prop];
}else{
return elem.currentStyle[prop];
}
}