vitch/jScrollPane — Issue #103: Cannot get the scrollbars to re-appear after ajax load into div
Author: alexcroox
Created: 2011-10-13 21:36:46+00:00
State: open

HTML looks like this:

...

Plugin initialized like this (works fine)

$(function()
{
window.settings = {
verticalDragMinHeight: 35,
mouseWheelSpeed: 321,
animateScroll: true
};
var pane = $('.scrolling');
pane.jScrollPane(settings);

// using window because I've tried everything else!
window.api = pane.data('jsp');
});

That loads the scroll bar fine, however when I make an ajax call to update the html in that pane, the scroll bars never come back

$('a.category').click(function(e)
{
e.preventDefault();

$('div.list').html('');

$.ajax({
url: appPath+'category.php',
type: 'POST',
data: 'category='+$(this).attr('rel'),
success: function(data)
{
$('div.list').html(data);
var refreshDiv = setTimeout(function()
{
api.reinitialise();
console.log('refreshed');
}, 3000);
}
});
});

I've tried replacing api.reinitialise(); with a new jScrollPane() call but that doesn't work either.

Any help would be much appreciated this is driving me up the wall!