我目前正在使用以下条件,但这些条件根本无法跨浏览器工作:
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
}
我相信我遗漏了一两个条件——也许还有一个我没有考虑到的常见表达。
我需要添加什么才能完成此操作?