Smooth Scroll With Inertia Support – scrooth

Category: Animation , Javascript | January 25, 2021
Author:shererere
Views Total:2,399 views
Official Page:Go to website
Last Update:January 25, 2021
License:MIT

Preview:

Smooth Scroll With Inertia Support – scrooth

Description:

scrooth is a small JavaScript library that adds a configurable, momentum style smooth scroll effect to the native page scroll.

How to use it:

Import the scrooth library into your document and done.

<script src="scrooth.js"></script>

By default, scrooth will automatically enable the smooth scroll effect on the whole body:

const body = new Scrooth();

You can also initialize the scrooth on any scrollable element you prefer.

const scroll = new Scrooth({
      element: window // target element
});

Config the smooth scroll with the following parameters.

const scroll = new Scrooth({
      strength: 10,
      acceleration: 1.2,
      deceleration: 0.975
});

Changelog:

01/26/2021

  • Prevent flickering

11/06/2018

  • JS refactor

You Might Be Interested In:


Leave a Reply