1.2.5 • Published 4 years ago

smooth-scroll-anchor v1.2.5

Weekly downloads
74
License
ISC
Repository
github
Last release
4 years ago

Smooth Scroll Anchor

Automatically scroll to any given anchor links.

Install

npm i --save smooth-scroll-anchor

Use

import { smoothScrollAnchor } from "smooth-scroll-anchor";
smoothScrollAnchor();

Markup

<a href="#target">Click to scroll</a>
<div id="target">Target element</div>

Options

A few cheeky lil' things can be configured like so:

smoothScrollAnchor({
  behaviour: "smooth", // [smooth | auto] Smooth animated scroll or instant
  block: "center", // [start | center | end | nearest] Alignment of the target element when it's finished scrolling
  offset: 200 // Optional offset of the target scroll position. Handy if you have a fixed header!
});

Support

IE11+, Edge (via polyfill) and all modern browsers (native functionality)

1.2.5

4 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago