https://github.com/codersuresh/smooth-scroll
NPM package to implement smooth scroll behaviour on back press
https://github.com/codersuresh/smooth-scroll
npm npm-package web
Last synced: 2 months ago
JSON representation
NPM package to implement smooth scroll behaviour on back press
- Host: GitHub
- URL: https://github.com/codersuresh/smooth-scroll
- Owner: coderSuresh
- Created: 2023-07-16T08:50:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-16T11:13:29.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T12:26:47.275Z (about 1 year ago)
- Topics: npm, npm-package, web
- Language: JavaScript
- Homepage: https://smooth-scroll-on-back-press.netlify.app/
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Smooth Scroll on Back Press
[](https://badge.fury.io/js/smooth-scroll-on-back-press)
## Description
This is a simple script to add smooth scroll to anchor links on your website. When a user clicks on an anchor and goes to the different page and comes back to the page where the anchor link is, the page will scroll to the anchor link smoothly.
## Installation
1. Run `npm install smooth-scroll-on-back-press` to install the package.
2. Add the following code to your JavaScript file such as `app.js`
```javascript
import smoothScroll from 'smooth-scroll-on-back-press';
smoothScroll();
```Now you are good to go. The script will automatically add smooth scroll to all the anchor links on your website.
## Example
You can see the example [here](https://smooth-scroll-on-back-press.netlify.app/).## Limitations
The script will not work if there is no scroll on the page after the page load.