inuyaksa / jquery.nicescroll

nicescroll plugin for jquery - scrollbars like iphone/ipad
https://nicescroll.areaaperta.com/
3.6k stars 1.67k forks source link

niceScroll not working with various accordion styled contents #727

Open Jeeosch opened 6 years ago

Jeeosch commented 6 years ago

I really like the new version of niceScroll and the iFrame helper is truly fixing the problems I had with an iframe on my band's web page.

But now I ran into the next problem ...

I have updated large parts of our site "under the hood" and have consequently replaced a few jquery plugins, one of which is niceScroll.

Since the update jQuery is no longer working on the two pages with accordion style content:

I'm pulling my hair out what the issue could be. By the way: for testing purposes I have used two different accordion plug-ins on both pages, but without success.

I'd be grateful for any hint!

Jeeosch commented 6 years ago

Just wanted to add that the plugins used on both sites seem to use the jQuery UI accordion plugin as basis.

Allmedialab commented 6 years ago

Hi, Looked at your site. Sorry to say so, but it is a real mess. You are using various versions of jQuery on different pages. I would start with trying version 2 instead of 3, because 3 doesn't work on a lot of older scripts. But I see the accordion open and close?

t in Geilenkirchen at the moment for a company there.

Regards, David my website: https://www.allmedialab.nl

Yinkci commented 6 years ago

Did you solved your problem? If so, may I know how you did it? This is my exact problem in my wordpress site

Link: http://swosh.com.ph/faqs/

When you open all of the accordion the nicescroll is not changing.

Jeeosch commented 6 years ago

Hi,

 

yes, solved it!

 

You need to catch all events, which dynamically change the page height, and let them execute the "resize" method of niceScroll.

 

Here's an example:

 

$('.accordionbutton').click(    function(e){       setTimeout(function(){          $('html, body').getNiceScroll().resize()       }, 600)    } );

 

On our media page there's a vertical content accordion and each time you click on one of the headlines (class "accordionbutton") the height of the page is changing, because one content area opens and the other one closes.

Since the accordion is set to expand/close with an animation of 500ms I have used a timer of 600ms to give enough time for the new page height to be settled.  

Best regards,

 

 

Georg

 

 

PS: Since I am working with RapidWeaver the class name is in reality somewhat longer. I have shortened it for the example.

 

 

Gesendet: Dienstag, 12. Dezember 2017 um 07:08 Uhr Von: "Yinkci Heart" notifications@github.com An: "inuyaksa/jquery.nicescroll" jquery.nicescroll@noreply.github.com Cc: Jeeosch Georg.Houben@web.de, Author author@noreply.github.com Betreff: Re: [inuyaksa/jquery.nicescroll] niceScroll not working with various accordion styled contents (#727)

Did you solved your problem? If so, may I know how you did it? This is my exact problem in my wordpress site

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

 

AEM515 commented 5 years ago

setTimeout(function(){ $('html, body').getNiceScroll().resize() }, 600)

this is rock, and still working for today. saved my day

Hi, yes, solved it! You need to catch all events, which dynamically change the page height, and let them execute the "resize" method of niceScroll. Here's an example: $('.accordionbutton').click( function(e){ setTimeout(function(){ $('html, body').getNiceScroll().resize() }, 600) } ); On our media page there's a vertical content accordion and each time you click on one of the headlines (class "accordionbutton") the height of the page is changing, because one content area opens and the other one closes. Since the accordion is set to expand/close with an animation of 500ms I have used a timer of 600ms to give enough time for the new page height to be settled. Best regards, Georg PS: Since I am working with RapidWeaver the class name is in reality somewhat longer. I have shortened it for the example.

rejowanahmed commented 4 years ago

You can also try these methods on stackoverflow. Both work perfectly and it's for all.

https://stackoverflow.com/questions/11862656/jquery-nice-scroll-not-working/11876895