Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple jscrolls && Exposed destroy API #116

Open
breezern opened this issue Nov 28, 2016 · 2 comments
Open

Multiple jscrolls && Exposed destroy API #116

breezern opened this issue Nov 28, 2016 · 2 comments
Assignees
Labels

Comments

@breezern
Copy link

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.

  1. .data('jscroll') is bind to $e, so .removeData('jscroll') does not work.
  2. $(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

@mkoch42
Copy link

mkoch42 commented Jan 15, 2017

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!

@pklauzinski pklauzinski self-assigned this Jan 16, 2017
@viksharma31
Copy link

Hii

I am getting not a function error on ".jscroll().destroy();". What is the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants