I don’t understand the documentations at jScrollPane at all. http://jscrollpane.kelvinluck.com/#examples
They give an example as such to start (Assuming there is text in this class):
$(function()
{
$('.scroll-pane').jScrollPane();
});
That does not work at all. Instead, I have to do something like this
HTML:
<div id="dummy">Put few paragraphs here for overflow</div>
<div id="wrapper">
<div id="oflow"></div>
</div>
<a href="" id="get">Get text</a>
JS:
$(function(){
$("#get").click(function() {
$("#oflow").html($("#dummy").text());
$("#wrapper").jScrollPane();
});
});
So… Question: If I turn it into a function and use it in this way for loading text with $.get() and inserting new content with $(element).html(e.responseText), jScrollPane only works for on first click on any content loading.
I’ve ran a sample at jsFiddle and can’t get it to work properly. The jscrollpane should go away when a large amount of text is replace by less content. http://jsfiddle.net/robx/Hq5hC/10/
user jquery live as it binds to the elements which can come in future
this is problem in your code
this is killing the event..
http://api.jquery.com/live/
example