1.0.0 • Published 5 years ago

@pxlrbt/smoothscroll v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Smoothscroll

Smoothly scroll to anchor links.

Installation

npm install @pxlrbt/smoothscroll

Usage

import Smoothscroll from '@pxlrbt/smoothscroll';
new Smoothscroll({
    speed: 400,
    elementSelector: 'a[href*="#"]',
    useHash: true,
    threshold: function () {
        return document.querySelector('header').offsetHeight;
    }
});
<a href="#section">Scroll to section</a>
...
<section id="section">...</section>