jscroll
jscroll copied to clipboard
Multiple jscrolls && Exposed destroy API
Hi, this is a convenient, small and exquisite plugin.But i get some issues here.
First,i want to set multiple jscrolls within a tab plugin, there is only one jscoll instance displayed at the same time , so i have to set .jscroll{ overflow-y: scroll; height: xxxpx;} in my CSS file. But i do not want to set a fixed height for my jscroll instance.
Then, i get an idea that , when i set a tab to be active , i can destroy the old one and create a new one.But i find that the exposed destroy() API does not work.
_destroy = function() {
return _$scroll.unbind('.jscroll')
.removeData('jscroll')
.find('.jscroll-inner').children().unwrap()
.filter('.jscroll-added').children().unwrap();
}
So i go to read the code, if _$scroll === $(window), there are two issues.
.data('jscroll')is bind to$e, so.removeData('jscroll')does not work.$(window).find('.jscroll-inner')returns[].
So i change some lines:
_destroy = function() {
$e.removeData('jscroll')
.find('.jscroll-inner').children().unwrap()
.filter('.jscroll-added').children().unwrap();
return _$scroll.unbind('.jscroll');
}
Now, i want to know is there some side effect ?
Thanks, breezern
I was also having issues with the .destroy() method and had reverted to using .data('jscroll',null) which caused different issues - i altered my destroy() function to match breezern's changes above and started using the .destroy() method and it appears to be working well -
Thank you!
Hii
I am getting not a function error on ".jscroll().destroy();". What is the issue?