1 回答

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超14個(gè)贊
document.documentElement返回的是html元素,它是只讀的。
body返回的就是body元素.
elem = document;
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
獲取頁面高度jquery是這么實(shí)現(xiàn)的,取幾個(gè)的最大值能解決一些兼容性等的問題。
添加回答
舉報(bào)