inuyaksa / jquery.nicescroll

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

Issues when scroller content length changes #77

Closed dademaru closed 11 years ago

dademaru commented 12 years ago

Hi, thanks for your plugin. I'm having some issues when scroller content length changes, for example using isotope plugin or some content slide effects (expand / collapse). With isotope, after filtering my items, the 'ul' becomes shorter, but the cursor doesn't reflect this change (it's smaller than it should be, if the sliding content isn't as long as at begining, or it still appears even if no more needed, when sliding content is shorter than the scroller wrapper). With slideDown / slideUp jQuery effects, if the sliding content is hidden on page load, after expanding it I can't scroll the div with nicescroll; on the contrary, if all the sliding content is already expanded, when I collapse them the cursor remains proportional of the original content lenght. Is it possible to implement the .on() event? What exactly should I do? Thanks

germanz commented 12 years ago

Hi, did you tried to call resize method of nicescroll after expanding your div or whenever content changes? Something like this:

// Wait for animation to be finnished $('#foo').slideDown('slow', function() { // Call resize to recalculate the height of the scrollbar $("#bar").getNiceScroll().resize(); });

I had similar issue, and calling resize helped.

dademaru commented 12 years ago

Thanks germanz: I've called resize method as you suggested and now with sliding contents the scrollbar appears / disappears or autoresizes correctly. With isotope filtering I've tried to call resize method but nothing changed. Maybe here is a solution: http://isotope.metafizzy.co/docs/extending-isotope.html but I'm not sure where to start.

inuyaksa commented 12 years ago

Sorry I don't know isotype framework. Can I watch an example of you code?

dademaru commented 12 years ago

Hi, well it's the same code you find at this page: http://isotope.metafizzy.co/demos/combination-filters.html I wrapped the ul with filterable items in a 580 x 580 px box; I've tried with iScroll but it doesn't seem compatible with isotope on iPad (always for the resize / refresh problem), then I've discovered nicescroll and now I have to understand how to solve this. If you have any idea let me know, thanks.

inuyaksa commented 12 years ago

Try this solution: http://stackoverflow.com/questions/5433862/callback-for-jquery-plugin-isotope

You have to set "complete" to call nicescroll resize from animationOptions.

inuyaksa commented 11 years ago

no user reply