HTML/DOM: What is standards equivalent of document.body.scrollHeight?

前端 未结 1 1742
有刺的猬
有刺的猬 2021-01-06 02:19

For nearly a decade i\'ve been using:

document.body.scrollHeight 

to return the \"ideal\" height of the browser window. This worke

相关标签:
1条回答
  • 2021-01-06 03:20

    document.documentElement.scrollHeight I believe.

    For viewport it's window.innerHeight for modern browsers.

    If the above aren't what you want, here's a list of a bunch of them:

    • document.documentElement.[scrollHeight,clientHeight,offsetHeight]
    • document.body.[scrollHeight,clientHeight,offsetHeight]
    • window.[inner,outer][Height,Width] ( modern browsers only )
    0 讨论(0)
提交回复
热议问题