-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Smooth scrolling when clicking header links #567
Smooth scrolling when clicking header links #567
Comments
Like scrolling back to top? |
Current header links are using simple anchors. The page jumping is handled by browser. If we want smooth scrolling, we probably need to implement ourselves. |
Ok - for sure I know what smooth scrolling is. Just wanted to get sure, as the issue doesn't have any further description. I think, this might be the wrong place to ask for this feature as this belongs to the behavior of Vue Router. There are some issues regarding smooth scrolling in the Vue Router repo, but still no final solution as it still would need 3rd party scripts. Nevertheless, there are ways shown to implement it by your own needs. |
That could be a theme-scope consideration. It's better to implement the feature in default theme, but not in core. |
@chrtz I don't think this needs any third-party library or anything to do with Vue router. Since anchor is something native to browser. |
@ycmjason no worries. :D just wanted to clarify that I know what you mean. I just still think this is related to Vue Router as this can handle the scroll behavior. |
Latest changes have implemented smooth scrolling. However, it comes with several issues:
Browsing to a specific scroll position is a common task that will happen very often when browsing a documentation and should not involve that much noise (changes in URL, blinking of activated/deactivated sidebar headers, scroll duration) and unusual behavior (locked scrollbar). There is also an issue that after you opened the page and click on a navbar item, it will highlight the navbar item you clicked on, then highlight the item you are at again (this is the issue) and then toggle through all the items in between while scrolling (inconsistent too when section is small) . This all does not look right. There needs to be an option to disable smooth scrolling for on-page/cross-page navigation that does not cause inconsistent behavior (see #1016). |
Yeah, i agree with @matjaeck, it is wasting time when you jump between anchors in a very very long doc. |
Maybe this can be configurable and done with |
I've created a small plugin vuepress-plugin-smooth-scroll for this. But it does not work so well with |
Any movement on this? |
* feat($plugin-active-header-links): replace throttle by debounce * feat($theme-default): use plugin-smooth-scroll (close #567) * feat($theme-default): smooth-scroll option * docs: smooth-scroll option of default theme * docs: enable smooth-scroll
Contribution welcome!
The text was updated successfully, but these errors were encountered: