-
|
When you go to https://watercss.kognise.dev/, scroll down and click the "Back to top" button, you get a smooth scrolling animation. This does not seem to be part of the framework (obviously I guess impossible to do with CSS), so I wonder where this came from? On my site using water.css this does not happen automatically? But would be nice if done easily. I even checked the source code and did not find anything related to (smooth) scrolling: Firefox 147 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hey! On the current site, this was done by setting 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' }) |
Beta Was this translation helpful? Give feedback.
Hey! On the current site, this was done by setting
scroll-behavior: smoothon thehtmlelement in custom CSS for the page: https://github.com/kognise/water.css/blob/master/docs/style.css#L1-L3However, 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: