coderSuresh / smooth-scroll

NPM package to implement smooth scroll behaviour on back press

Home Page:https://smooth-scroll-on-back-press.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smooth Scroll on Back Press

npm version

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

    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.

Limitations

The script will not work if there is no scroll on the page after the page load.

About

NPM package to implement smooth scroll behaviour on back press

https://smooth-scroll-on-back-press.netlify.app/


Languages

Language:JavaScript 100.0%