Skip to content

Conversation

@stephan-nordnes-eriksen

This fix checks if a user, or some other system, has changed the scroll position during the ongoing scroll, and if so, stops the current smooth scroll.

I am not 100% sure if this is the specified behaviour for the smooth scroll, but it makes sense to me.

Cancelling scroll if user, or other system, changes the scroll position mid-scroll.
@stephan-nordnes-eriksen
Copy link
Author

stephan-nordnes-eriksen commented Jul 25, 2016

Note;

There are two things I am not sure I did right, so if someone with a bit better understanding of this library could check, that would be great.

1

I am monitoring the document.body's scrollLeft and scrollTop properties. It might be some other element which should be monitored.

2

I am checking context.startX and context.startY against their previous value, which might not be necessary.

@stephan-nordnes-eriksen
Copy link
Author

Interesting: I also found that the method findScrollableParent sometimes gives the wrong element. (gives different parent for two li elements of same ul). This particular case makes the code above break, so please don't merge this yet.

@rakusai
Copy link

rakusai commented Sep 11, 2019

I agree that scrolling should be stopped if scroll function has been called again.
This seems default behavior of Chrome and Firefox.
I'm not sure that this should be stopped by the user action.

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

Successfully merging this pull request may close these issues.

2 participants