jamesflorentino / nanoScrollerJS

A jQuery plugin that offers a simplistic way of implementing Lion OS scrollbars.
http://jamesflorentino.github.com/nanoScrollerJS/
MIT License
2.69k stars 502 forks source link

Disable auto-scroll-to-end when new items are added #254

Closed felipe-pereira closed 10 years ago

felipe-pereira commented 10 years ago

Hi, I'm implementing an infinite scroll and what happens is this;

My question is; is there a way to stop this auto scroll from happening?

Thank you.

kristerkari commented 10 years ago

Hello, nanoScroller is not supposed to be autoscrolling, so would it be possible for you to setup a small demo that shows this behavior?

felipe-pereira commented 10 years ago

Hi, I buit a simple fiddle (no angular, no server calls) and it worked as expected, the accurate example is bit more complex and I was waitng to get some advice before dedicate the time to build it.

Do you know if there is something fishy regarding this kind of usage?:

kristerkari commented 10 years ago

Alright, maybe Angular somehow auto scrolls when it renders new data to the view. Kind of hard to guess without seeing any code.

felipe-pereira commented 10 years ago

I got the fiddle

http://jsfiddle.net/wm60L6as/2/

To reproduce the issue you have to scroll slowly (one mouse wheel movement at a time), you can see that when the end is reached, the bar stays at the bottom and then jumps to is correct position with the next mouse wheel movement (if any, if not it just stays at the bottom).

Commented there is a fix, the bad news is that that fix doesn't solve the problem in my app (where the scroll is on a side togglable list over a map from google). In my app the 'scrollend' event fires twice (maybe this gives you a clue) This double trigger was due to the wrapper used (https://github.com/maxaon/angular-nanoscroller)

Let me know if you think that something can be done on my side to prevent this, thank you. After fixing the double event trigger in the wrapper I got it working as expected, if you want to check in depth was is happening on the fiddle go ahead, if not just close this issue since it is something minor, thanks.

kristerkari commented 10 years ago

Alright, good that you got it fixed