1. 程式人生 > >取不同瀏覽器可視區域寬高方法

取不同瀏覽器可視區域寬高方法

new function family The port onos idt pac offset

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 } }}

取不同瀏覽器可視區域寬高方法