Tiny Smooth Scroll Library – smoothScroll.js

Category: Animation , Javascript | October 12, 2017
Author: HjalmarSnoep
Views Total: 72
Official Page: Go to website
Last Update: October 12, 2017
License: MIT

Preview:

Tiny Smooth Scroll Library – smoothScroll.js

Description:

smoothScroll.js is an ES5/ES6 JavaScript library used to implement the configurable smooth scroll behavior on your long web page.

How to use it:

Include the ES5 version of the smoothScroll.js library on the html page.

<script src="smoothScroll-ES5.js"></script>

Create a trigger link and specify the position you want to scroll to using the ‘ScrollTo’ attribute like so:

<div id="top"></div>
  ...
<a href="#top" scrollTo="top">Back to top</a>

Set the duration of the animation.

<div id="top"></div>
  ...
<a href="#top" 
   scrollTo="top"
   duration="2000"
>Back to top</a>

Customize the easing effect.

<div id="top"></div>
  ...
<a href="#top" 
   scrollTo="top"
   duration="2000"
   easing="linear"
>Back to top</a>