javascript - Questions about document.documentElement.scrollTop and document.body.scrollTop
为情所困
为情所困 2017-07-05 10:41:05
0
2
784

Please help. . I just encountered a problem about the adaptation of document.documentElement.scrollTop and document.body.scrollTop. I read online that document.documentElement.scrollTop is used in standard mode. . But why do I test that the value of document.documentElement.scrollTop is always 0 in HTML5 standard mode, while document.body.scrollTop has a value?

为情所困
为情所困

reply all(2)
世界只因有你

Different browsers process different results
Poke me

ringa_lee

Browser compatibility issue.
It is recommended to write
let top = document.documentElement.scrollTop || document.body.scrollTop

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!