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

scrollTop property not working as expected #929

Open
Daverine opened this issue Jan 1, 2021 · 0 comments
Open

scrollTop property not working as expected #929

Daverine opened this issue Jan 1, 2021 · 0 comments

Comments

@Daverine
Copy link

Daverine commented Jan 1, 2021

Your system information

  • VelocityJS version: 2
  • Browser: chrome
  • Operating System: windows 8

Checklist

  • Is this an issue with code?: [Yes/No]
  • Is this an issue with documentation?: [Yes/No]
  • Have you reproduced this in other browsers?: [Yes/No]
  • Have you checked for updates?: [Yes/No]
  • Have you checked for similar open issues?: [Yes/No]

Please remember that this is an issue tracker, support requests should be posted on StackOverflow - see CONTRIBUTING.md

Please describe your issue in as much detail as possible:

Describe what you expected should happen and what did happen.
animating the scrollTop using scrollTop property only work if the scrollTop position is at 0px. So if the scrollTop position have changed from 0, it can only animate back to 0. Aside from that it wont work.
Example:
// html scrollTop position is at 0px
$("html").velocity({scrollTop: 500}, {duration: 2000}) // it will work
// html scrollTop position is at 500px
$("html").velocity({scrollTop: 700}, {duration: 2000}) // it wont work
//html scrollTop position is at 500px
$("html").velocity({scrollTop: 0}, {duration: 2000}) // it will work

Steps for reproducing this issue (code):

JSFiddle example showing issue in action (code):

Go to https://jsfiddle.net/Rycochet/mqv9L27u/ - click the "Fork" button at the top, create the example and copy the new URL back here.

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

No branches or pull requests

1 participant