Smooth Scroll With Inertia Support – scrooth

Category: Animation , Javascript | April 15, 2018
Author: shererere
Views Total: 192
Official Page: Go to website
Last Update: April 15, 2018
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
});

Leave a Reply