第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

documentElement和body的區(qū)別?

documentElement和body的區(qū)別?

慕虎7371278 2018-09-12 13:19:12
今天學(xué)習(xí)scrollHeight時(shí)候,在谷歌控制臺(tái)發(fā)現(xiàn)document.documentElement.scrollHeight === document.body.scrollHeight返回的是true,我想知道documentElement和body的區(qū)別?
查看完整描述

1 回答

?
大話西游666

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è)的最大值能解決一些兼容性等的問題。


查看完整回答
反對(duì) 回復(fù) 2018-10-31
  • 1 回答
  • 0 關(guān)注
  • 888 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)