Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pxlrbt/smoothscroll

Smoothly scroll to anchors.
https://github.com/pxlrbt/smoothscroll

javascript js smooth-scrolling smoothscroll vanilla-javascript vanilla-js vanillajs

Last synced: about 1 month ago
JSON representation

Smoothly scroll to anchors.

Awesome Lists containing this project

README

        

# Smoothscroll

Simple vanilla js library to smoothly scroll to anchors.

## Installation

```bash
npm install @pxlrbt/smoothscroll
```

## Usage

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

```html
Scroll to section
...
...
````