我目前正在使用以下条件,但它们不能跨浏览器或根本不工作:
if (typeof (window.innerHeight) == 'number') {
//Non-IE:
//Perform operation using window.innerWidth/Height
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
//Perform operation using document.documentElement.clientWidth/Height
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
//IE 4 compatible
//Perform operation using document.body.clientWidth/Height
}
我相信我错过了一个或两个条件——也许还有另一个我没有考虑到的常见表达方式。
我需要添加什么才能完成?