Native Smooth Scroll Polyfill – smoothscroll.js

Category: Animation , Javascript , Recommended | December 2, 2019
Author: iamdustan
Views Total: 34
Official Page: Go to website
Last Update: December 2, 2019
License: MIT

Preview:

Native Smooth Scroll Polyfill – smoothscroll.js

Description:

smoothscroll.js is a lightweight, configurable, Vanilla JavaScript polyfill for native smooth scroll using CSS scroll-behavior: smooth property.

Use this polyfill to implement the smooth scroll to functionality on those browsers that don’t’ support the native smooth scroll behavior: MS Edge, Internet Explorer, and Safari.

How to use it:

1. Install the smooth scroll polyfill.

# Yarn
$ yarn add smoothscroll-polyfill

# NPM
$ npm install smoothscroll-polyfill --save

2. Import the smoothscroll module.

import smoothscroll from 'smoothscroll-polyfill';

3. Call the smoothscroll polyfill and done.

smoothscroll.polyfill();

4. Scroll the webpage using the following native JS API.

You Might Be Interested In:


Leave a Reply