Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

smooth-scroll-on-back-press

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smooth-scroll-on-back-press

A simple NPM package to implement smooth scroll on back press functionality

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

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

  • Run npm install smooth-scroll-on-back-press to install the package.

  • 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.

FAQs

Package last updated on 16 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts