# vuepress-plugin-smooth-scroll

Make scrolling smooth in your VuePress site.

# Installation

npm install -D vuepress-plugin-smooth-scroll

# Usage

# Use this plugin

// .vuepress/config.js
module.exports = {
  plugins: ['vuepress-plugin-smooth-scroll'],
}

# Details

This plugin simply does two things:

  1. Use window.scrollTo({ behavior: 'smooth' }) for scrollBehavior
  1. Add scroll-behavior: smooth; to the <html> element

TIP

  • The first one only works with <RouterLink to="#anchor">
  • The second one works with both <RouterLink to="#anchor"> and <a href="#anchor">

You may notice that the browser compatibility of this two features are quite different, so we currently use both of them.

For better browser compatibility, we suggest to use <RouterLink to="#anchor"> in your markdown file if possible.

# Demo

  • Click the links in the sidebar
  • Click the header anchors

This
is
used
to
make
the
page
longer

# End of the page