[jQuery] Adding/Removing and Resizing jScrollPane - Reinitializing jScrollPane

[jQuery] Adding/Removing and Resizing jScrollPane - Reinitializing jScrollPane


I am building a little widget which is using jScrollPane to add a
scrollbar for where the data doesn't fit inside the alloted space.
When the user clicks on the data, I hide what they had, and show the
clicked data in a different format.
Sometimes the data needs a scrollbar, sometimes not, and sometimes the
ammount of scrolling needs to be resized.
I've taken a look at how Kevin Luck reinitializes the jScrollPane with
ajax data (mine is not loaded via ajax, just a different display of
the data), but I can't seem to get it to work.
My code looks like this
<code>
function addRemovejScrollPane(containedDiv){
alert(jQuery(containedDiv).height());
if(jQuery('div#holdAll').height()<jQuery(containedDiv).height()){
jQuery('div#holdAll').jScrollPane();
}
if(jQuery('div#holdAll').height()>=jQuery(containedDiv).height
()){
jQuery('div#holdAll').jScrollPaneRemove();
}
}
</code>
This is attempting to get the height of the child, and if larger,
reinitialize the scrollbar, if smaller, remove the scrollbar.
Is there a better way to do this?
I add the 'containedDiv' because I have all my divs within holdAll,
and then I show and hide them based on user actions.



























    • Topic Participants

    • pete