I could really use some help implementing the destroy method on
jScrollPane.
http://mgh.bigheadservices.com/sweets/v4/index-test.html
I have a whole bunch of stuff going on with this page. The gist of it
is that the dimensions of the 3 main content areas are based on
available viewport dimension and the dimensions of each's siblings.
What this means is that anytime a user changes the size of their
window, the layout must adjust to the new size.
To implement the jScrollPane, I wait until the new box dimensions have
been set. This is all handled in the very bloated setDimensions()
function.
I was initially setting the jSP with $
('.scrollbars').jScrollPane({showArrows: true});
The problem is that I really need to destroy them at the beginning of
the function and initialise them after everything is set. To do this,
I moved the initialization and destroy methods to their own functions
and then called those functions in the setDimensions function.
I used the example on Kelvin's site creating:
apis = [];
function addScrollbar(){
$('.scrollbar').each(function(){
apis.push($(this).jScrollPane({showArrows: true}).data().jsp);
});
return false;
}
and
function destroyScrollbar(){
if (apis.length){
$.each(apis, function(i) {
this.destroy();
});
apis = [];
}
return false;
}
In Firefox, I get this.destroy is not a function.
In console, when I type apis; it returns [undefined, undefined,
undefined, undefined, undefined], so the count is correct. I don't
know that it shouldn't be naming the objects though.
Can anybody tell me what I'm doing wrong, please?