0

我正在使用 jsFiddle 来获得所需的结果,尽管我失败了。

这是链接: JsFiddle

我希望没有 p 标签的 div 也有一个垂直滚动条!虽然行不通。

JS:

$(document).ready(function() {
    $(".scroll-pane").jScrollPane({autoReinitialise: true});
});

HTML:

<!-- this works -->
<div class="scroll-pane other">
    <p>dslkfja;dasfj;asdkfj</p>
    <p>d;aslkfjasd;lfkdas;kfj</p>
    <p>d;aslkfjasd;lfkdas;kfj</p>
    <p>d;aslkfjasd;lfkdas;kfj</p>
    <!-- and so on... -->
</div>

<!-- this does NOT work -->
<div class="scroll-pane other">
    asdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    asdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    asdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    <!-- and so on... -->
</div>
4

1 回答 1

1
your code is working already

but you make a single string "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" in your js fiddle so it not set breaks in small string then it work 

我设置了一个演示看这里

于 2013-08-21T13:32:13.123 回答