jQuery,UL上的jScrollPane [英] jQuery, jScrollPane on UL

查看:109
本文介绍了jQuery,UL上的jScrollPane的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我无法使它工作.

I cannot make this work for some reason.

我希望将jscrollpane用于无序列表(ul).

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

我已经设法做到了这一点,但是当与嵌套ul一起使用时,它似乎不起作用. 我已将示例上载到jsFiddle,因此任何人都可以看一下并弄弄.

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.

您可以在这里查看: http://jsfiddle.net/44db/eAX8b/

推荐答案

我昨天发布了此答案,但在

I posted this answer yesterday but on the wrong question!

这里是正确的问题:

您不应将jScrollPane直接应用于UL.由于jScrollPane需要在页面上添加其他标记(以表示滚动轨道等),因此如果这样做,将导致HTML无效.相反,您应该将UL包装在例如一个div并对其应用jScrollPane.

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.

此外,当我查看您的示例时,您似乎在最初隐藏的元素上使用了jScrollPane.如果是这种情况,那么您需要在显示如本示例所示的元素之后重新初始化jScrollPane:

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

这篇关于jQuery,UL上的jScrollPane的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆