smooth-scroll-anchor
Smooth scroll to anchor links
Last updated 2 months ago by entozoon .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install smooth-scroll-anchor 
SYNC missed versions from official npm registry.

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)

Current Tags

  • 1.2.5                                ...           latest (2 months ago)

16 Versions

  • 1.2.5                                ...           2 months ago
  • 1.2.4                                ...           10 months ago
  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.4                                ...           2 years ago
  • 1.1.3                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 1
Dependencies (1)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |