Mantisimo
Mantisimo

Reputation: 4283

JQuery jScrollPane reinitialise

I'm using the JQuery plugin jScrollPane

I'm intialising it as follows.. It works initially but when I try and change the settings and reinitialise it it doesnt work properly it kindof flickers and then returns to it's previous state, any ideas?

$(document).ready(function() {
     var api = $('.viewer').jScrollPane().data('jsp');
     api.reinitialise({
         showArrows: true
     }); 
});

Here is my test example

http://www.jsfiddle.net/VxYdJ/

Thanks

Upvotes: 3

Views: 12016

Answers (2)

martin
martin

Reputation: 51

i had the same problems with the reinitialisation of jsp. i could solve it with this workaround.

destroy …

$("#some > img").click(function() {
    var container = $('.scroll-pane-arrows');
    var api = container.data('jsp');
        api.destroy();

   … calculate width or similar

… and build it up later on:

$('.scroll-pane-arrows').jScrollPane({
    showArrows: true,
    arrowScrollOnHover: true,
    arrowButtonSpeed: 5,
    autoReinitialise: true
});

Upvotes: 5

Andrew Whitaker
Andrew Whitaker

Reputation: 126042

It looks like this is a known issue with jScrollPane. You could modify the source code as one commenter describes in the link above:

reinitialise: function(s)
{
    s = $.extend({}, settings, s);
    initialise(s);
},

That seems to fix the problem: http://www.jsfiddle.net/pNvky/ (The ton of code up front is just the modified plugin)

Upvotes: 2

Related Questions