Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/pxlrbt/smoothscroll
- Owner: pxlrbt
- Created: 2020-04-28T09:05:22.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-28T10:54:11.000Z (almost 5 years ago)
- Last Synced: 2024-11-29T17:26:32.782Z (about 2 months ago)
- Topics: javascript, js, smooth-scrolling, smoothscroll, vanilla-javascript, vanilla-js, vanillajs
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
...
...
````