문제

I have some ul elements with overflow: auto. Most of them don't overflow but a few of them do. I want to initialise jScrollPane only on those elements that have overflow, that have a scrollbar.

I can't see an obvious way in the docs to do this!

Perhaps I need to detect the presence of a scrollbar in some other way and then nest my jScrollPane initialisation inside that?

도움이 되었습니까?

해결책

You can check if the contents of the ul element is bigger than the display size of the ul with the following code:

$(yourobject).attr('scrollHeight') > $(yourobject).height() 

You can use the jQuery filter operation to filter your query.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top