How do I get the height of a div's full content with jQuery?

前端 未结 6 2144
[愿得一人]
[愿得一人] 2020-11-29 02:57

I am trying to create my own scroll bars. I have tried most of the jquery scrollbar plugins and none of them seem to work for me, so I decided to create my own. I have an ov

6条回答
  •  我在风中等你
    2020-11-29 03:17

    Element.scrollHeight is a property, not a function, as noted here. As noted here, the scrollHeight property is only supported after IE8. If you need it to work before that, temporarily set the CSS overflow and height to auto, which will cause the div to take the maximum height it needs. Then get the height, and change the properties back to what they were before.

提交回复
热议问题