jQuery, jScrollPane on UL

十年热恋 提交于 2019-12-11 04:19:51

问题


I cannot make this work for some reason.

I want jscrollpane to be used in an unordered list (ul).

I have managed to do this by itself but when used with a nested ul it does not seem to work. I have uploaded my example to jsFiddle so anyone can take a look and fiddle around.

You can have a look here: http://jsfiddle.net/44db/eAX8b/


回答1:


I posted this answer yesterday but on the wrong question!

Here it is on the right question:

You shouldn't apply jScrollPane directly to a UL. Because jScrollPane needs to add additional markup to your page (to represent the scroll track etc) it will result in invalid HTML if you do. Instead you should wrap your UL in e.g. a div and apply jScrollPane to that.

Additionally, when I look at your example it appears that you are using jScrollPane on elements which are initially hidden. If this is the case then you will need to reinitialise jScrollPane after showing the elements like in this example:

http://jscrollpane.kelvinluck.com/invisibles.html



来源:https://stackoverflow.com/questions/6310654/jquery-jscrollpane-on-ul

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!