# mdpress-plugin-smooth-scroll

Make scrolling smooth in your MdPress site.

# Installation

npm install -D mdpress-plugin-smooth-scroll

# Usage

# Use this plugin

// .mdpress/config.js
module.exports = {
  plugins: ["mdpress-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 <Link to="#anchor">
  • The second one works with both <Link 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 <Link 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