Momentum Scrolling In Vanilla JavaScript – SmoothScroll.js

Category: Animation , Javascript | April 11, 2019
Author: vtimsit
Views Total: 290
Official Page: Go to website
Last Update: April 11, 2019
License: MIT

Preview:

Momentum Scrolling In Vanilla JavaScript – SmoothScroll.js

Description:

A Vanilla JavaScript plugin that applies the momentum scrolling experience to web content. Make your webpage’s scrolling behavior like a native mobile app.

How to use it:

Download and insert the SmoothScroll.js library right before the closing body tag.

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

Initialize the library on the target container element.

new SmoothScroll('.container')

Config the duration of the animation.

new SmoothScroll('.container', {
    duration: 2000
})

Specify the speed curve of an animation:

new SmoothScroll('.container', {
    duration: 2000,
    timingFunction: 'cubic-bezier(0.23, 1, 0.32, 1)'
})

You Might Be Interested In:


Leave a Reply