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

How to reinitialize nanoScroller when its container is display:none #305

Open
topasi opened this issue Jun 22, 2015 · 4 comments
Open

How to reinitialize nanoScroller when its container is display:none #305

topasi opened this issue Jun 22, 2015 · 4 comments

Comments

@topasi
Copy link

topasi commented Jun 22, 2015

Thanks for the great plugin.

I am using this plugin now to my project, and I am also using bootstrap modal by default the modal is in hidden state (display:none) and appears when you toggle it. I used nanoScroller on the modal. The problem is why the slider wont appear.

what I found is when I resizing the browser or press F12, anything that changes the behavior of the screen the slider appears.

@kristerkari
Copy link
Collaborator

You have to have your element shown before re-initializing nanoscroller. That's because it will need to know the height of the element.

@topasi
Copy link
Author

topasi commented Jun 29, 2015

That's exactly my problem. I tried re-initialize the nanoScroller

$('#myModal').on('shown.bs.modal', function () {
$('.nano').nanoScroller();
});

but wont work either.

@kristerkari
Copy link
Collaborator

Maybe the element isn't still fully shown when 'shown.bs.modal' event fires?

Does this make any difference:

$('#myModal').on('shown.bs.modal', function () {
  setTimeout(function() {
    $('.nano').nanoScroller();
  }, 0);
});

@onvno
Copy link

onvno commented Mar 1, 2016

@kristerkari This problem i just met.try this:

$('#myModal'').mouseover(function(){
$('.nano').nanoScroller();
})

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

3 participants