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

前端 未结 6 2145
[愿得一人]
[愿得一人] 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:04

    scrollHeight is a property of a DOM object, not a function:

    Height of the scroll view of an element; it includes the element padding but not its margin.

    Given this:

    pancakes

    This yields 200:

    $('#x')[0].scrollHeight
    

    For example: http://jsfiddle.net/ambiguous/u69kQ/2/ (run with the JavaScript console open).

提交回复
热议问题