Closed jeedee closed 10 years ago
There is a bug in the destroy method which prevent jscroll to be rebinded. The data is always binded to $e but in the destroy method it tries to remove it from _$scroll which can be $e or window.
To resolve it I added $e to the private vars :
_$e = $e,
then I changed the destroy function
function _destroy() {
_$e.removeData('jscroll');
return _$scroll.unbind('.jscroll')
.find('.jscroll-inner').children().unwrap()
.filter('.jscroll-added').children().unwrap();
}
If the element is being replaced via ajax, then the original element you bound to no longer exists in the DOM, therefore you must reinitialize the jscroll behavior on the new element. Alternatively, you can bind the behavior by using delegation so that you can circumvent having to do this.
I have an instance of jscroll binded to my element
div#results
. Using filters, my user may narrow the search which launches an ajax request that updatesdiv#results
. It seems jscroll does not work after the content has changed (even if I have an element with the selector).I tried destroying jscroll and rebinding again once the content has changed but I had no success so far. Help?
Thanks!