ES6 Smooth Scroll Library – es6-scroll-to

Category: Animation , Javascript | August 1, 2018
Author:janrembold
Views Total:1,027 views
Official Page:Go to website
Last Update:August 1, 2018
License:MIT

Preview:

ES6 Smooth Scroll Library – es6-scroll-to

Description:

Yet another smooth scroll library written in ES6 that smoothly scrolls the page to the top or a specific point with an easing effect.

How to use it:

Install the es6-scroll-to package with NPM.

# Yarn
$ yarn add es6-scroll-to
# NPM
$ npm install es6-scroll-to --save

Import the es6-scroll-to as a module.

// ES 6
import {animatedScrollTo} from 'es6-scroll-to';

Scroll the page to a vertical point within the document.

// 1000px
animatedScrollTo(1000);
// or
animatedScrollTo({
  to: 1000
});

Customize the duration of the scroll animation.

animatedScrollTo({
  to: 1000,
  duration: 1000
});

Scroll the page to the top. Ideal for back to top button.

animatedScrollTo();

Apply an easing function to the scroll animation. This requires an easing library such as es6-easings.

animatedScrollTo({
  to: 1000,
  easing: easeInQuint
});

You Might Be Interested In:


Leave a Reply