https://github.com/bigcommerce/themes-lib-scroll-link
https://github.com/bigcommerce/themes-lib-scroll-link
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bigcommerce/themes-lib-scroll-link
- Owner: bigcommerce
- License: mit
- Created: 2021-06-03T12:56:32.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T13:53:11.000Z (over 2 years ago)
- Last Synced: 2025-02-24T03:45:01.845Z (over 1 year ago)
- Language: JavaScript
- Size: 1.11 MB
- Stars: 0
- Watchers: 6
- Forks: 2
- Open Issues: 19
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Bigcommerce Scroll Link Module
Scroll to the top or any ID / class
### Installation
```
npm i --save github:pixelunion/bc-scroll-link
```
### Usage
```
import $ from 'jquery';
import ScrollLink from 'bc-scroll-link';
new ScrollLink({
duration: 1000,
easing: 'swing'
});
```
### Options
`duration`:
the scroll duration in milliseconds.
`easing`:
easing (only 'swing' and 'linear' available by default).
`delay`: delay before scrolling.
`updateHash`: (defaults to `true`) add the target to the URL? Set to `false` if targeting classes instead of IDs.
### Methods
`scrollToContent(target)`: Scroll to a target without using an anchor / button.
### Some sample markup
```
Top
Jump to: Some Section
```