Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top