jScrollPane dynamic content
Asked Answered
R

2

7

i was trying to use the follow jquery plugin: http://jscrollpane.kelvinluck.com/dynamic_content.html
but i'm still no success when i try to reinitialize the API

I have a div (id=content) which receives the response from load() method (jquery), after all, I use $('#content).jScrollPane() again to refresh the scrollbar, but no success =\

can any one help me? thanks!

Recumbent answered 22/4, 2011 at 15:2 Comment(2)
funny i have the same problem! I can load the content then execute $('#content).jScrollPane() and that shows the scrollbars. repeating this (on content refresh) makes jScrollPane stop working. I know we have to reinitialize() but haven't figured out how yet.Darlleen
here's the answer... i declared 2 globals var _jsp_api; var _$items_list; (you will see the reason in a sec) then on document load i execute these 2 statemenets: _jsp_api = $(".scroll-pane").jScrollPane( whatever jsp options you need ).data('jsp'); _$items_list = _jsp_api.getContentPane(); now every time you need to update the content of the scrollable area u will use _$items_list instead of whatever you were using before and when the content changes you have to execute: _jsp_api.reinitialise(); that's all folks. hope this helps.Darlleen
B
11

A quick google yields the following from

http://jscrollpane.kelvinluck.com/dynamic_content.html

function refreshNav() {
    var pane = $('YOUR SELECTOR');
    var api = pane.data('jsp');
    api.reinitialise();
}

Works very well......

Brigadier answered 7/11, 2011 at 18:44 Comment(0)
D
4

...and if you want to refresh all scroll panes on your site use this:

function refreshPane() {
  var pane = $('YOUR SELECTOR').each(function(){
    var api = $(this).data('jsp');
    api.reinitialise();
  });   
}
Declarative answered 19/1, 2012 at 10:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.