//获取浏览器可视区宽度function getWidth() { ???if (window.innerWidth){ ???????return window.innerWidth; ???} ???else{ ???????if (document.compatMode == "CSS1Compat"){ ???????????return document.documentElement.clientWidth; ???????} ???????else{ ???????????return document.body.clientWidth; ???????} ???}}
//获取浏览器可视区高度function getWidth() { ???if (window.innerHeight){ ???????return window.innerHeight; ???} ???else{ ???????if (document.compatMode == "CSS1Compat"){ ???????????return document.documentElement.clientHeight; ???????} ???????else{ ???????????return document.body.clientHeight; ???????} ???}}
//获取浏览器卷曲高度function getscrollTop() { ???return document.documentElement.scrollTop || document.body.scrollTop;}
未完,待续...
JS 兼容大全
原文地址:https://www.cnblogs.com/CooLLYP/p/10134416.html