没有P标签的Div上的Javascript JScrollPane

时间:2013-08-21 13:24:14

标签: javascript jquery jscrollpane

我正在使用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>

1 个答案:

答案 0 :(得分: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 

我设置了一个演示,请参阅here