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

Removing nicescroll from element #51

Closed
david-sabata opened this issue Jul 18, 2012 · 4 comments
Closed

Removing nicescroll from element #51

david-sabata opened this issue Jul 18, 2012 · 4 comments

Comments

@david-sabata
Copy link

I ran into some issues while trying to implement horizontally sliding navigation. That means there are side-by-side divs where only one is visible at the time and each one of them is scrollable using Nicescroll.

But when a div slides off the visible area, its scroll track still stays in the place.

I found nicescroll.remove() method, but it doesn't seem to do the job.
I even tried basic scenario where I initialized the nicescroll on an element and then removed it, but the track still stayed in the DOM and visible.

Could this be a mistake in my code? Is remove even supposed to be called from outside?
And most importantly - is there a way to completely remove all additional elements, bindings and all from an element?

@inuyaksa
Copy link
Owner

When you change position of a div with nicescroll you have to force refresh of rails position.
Call resize method so scrollbar position has updated.

Have a look at shuffle example, you can find some advice to manage movable divs:
http://www.areaaperta.com/nicescroll/dev/shuffle.html

@david-sabata
Copy link
Author

You were right, combination of .resize().hide() (called after all jQuery effects finish) works!

I guess there is no need for real removing of NiceScroll from an element, so I close this issue.

Thank you for your great work! ;-)

@rbrickyboy
Copy link

Hi,
I got mine working fine using $("your element").niceScroll().remove();
make sure you set your element css to overflow:hidden so when it removes the niceScroll, browser doesn't replace it with default scrollbar,
Then at the callback just initialize it niceScroll again.

@leo9223
Copy link

leo9223 commented Mar 18, 2019

@rbrickyboy I think $("#scrollingDiv").getNiceScroll().remove(); is better. Works for me.

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

No branches or pull requests

4 participants