Skip to content
Discussion options

You must be logged in to vote

Hey! On the current site, this was done by setting scroll-behavior: smooth on the html element in custom CSS for the page: https://github.com/kognise/water.css/blob/master/docs/style.css#L1-L3

However, this makes it so all scrolling behavior is smooth on the page, and honestly I don't consider it a good practice. Instead, I would probably recommend using a button that triggers the following JavaScript:

window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rugk
Comment options

Answer selected by kognise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants