Reputation: 23
I have jScrollpane on my website, and one problem with it. What do i mean:
Looks like i have to reinitialize scrollpane. So i tried 'api.reinitialise();' on the script after i use 'hide()' and nothing happened. Whats wrong?
$(document).ready(function(){
$('.all_model').jScrollPane();
});
$("#check_kitchen").click(function(){
$( '.classic' ).show();
$( '.modern' ).show();
$( '.furniture' ).hide();
$( '.technik' ).hide();
var pane = $('.scroll-pane')
pane.jScrollPane(settings);
var api = pane.data('jsp');
api.reinitialise();
return false;
});
Upvotes: 2
Views: 6036
Reputation: 3387
I thing you call your API twice. First Time into the $(document).ready(), and the seconde time into your click event. And both are not targetting the same element (.all_model or .scroll-pane).
If your container is .scroll-pane, this should work :
$(document).ready(function(){
$('.scroll-pane').jScrollPane();
});
$("#check_kitchen").click(function(){
$( '.classic' ).show();
$( '.modern' ).show();
$( '.furniture' ).hide();
$( '.technik' ).hide();
var api = $('.scroll-pane').data('jsp');
api.reinitialise();
return false;
});
Or if your container is .all_model, this should work :
$(document).ready(function(){
$('.all_model').jScrollPane();
});
$("#check_kitchen").click(function(){
$( '.classic' ).show();
$( '.modern' ).show();
$( '.furniture' ).hide();
$( '.technik' ).hide();
var api = $('.all_model').data('jsp');
api.reinitialise();
return false;
});
Waiting your feedback.
Upvotes: 2