2013-08-21 88 views
0

我使用jsFiddle來獲得所需的結果,雖然我失敗了。JavaScript的JScrollPane沒有P標籤

這是鏈接: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
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

+0

可悲的是它不工作 編輯:這確實得益於p標籤,感謝隊友 – JustBasti

+0

其工作見這裏http://jsfiddle.net/riturajratan/Rq7b2/69/ –