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

Stopping scroll if user or other system scrolls screen mid-smooth scroll #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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