1

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?

1 Answers1

2

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.

Matthijs P
  • 1,144
  • 1
  • 9
  • 17