Lightweight Smooth Scroll Library – youscroll.js

Category: Animation , Javascript | May 23, 2017
Author: SalimSalici
Views Total: 488 views
Official Page: Go to website
Last Update: May 23, 2017
License: MIT

Preview:

Lightweight Smooth Scroll Library – youscroll.js

Description:

Just another scroll to JavaScript library that enables the webpage to smoothly scroll to a specific point (or scroll down to a certain amount of pixels).

Basic usage:

Insert the JavaScript file youscroll.js into the document and the youscroll.js.

<script src="dist/youscroll.js"></script>

Scroll the webpage to a specific selector within the document.

<button onclick="youScroll.to('footer').start()" class="btn btn-primary">Scroll To Bottom</button>

Scroll down the webpage to a certain amount of pixels.

<button onclick="youScroll.by(200).start()" class="btn btn-primary">Scroll Down By 200px</button>

Execute a callback function when the smooth scrolling ends.

<button onclick="youScroll.to('nav').setCallback(backToTopCallback).start()">Scroll To Top With A Callback</button>
function backToTopCallback() {
  alert("Back to top");
}

The Default settings to config the smooth scroll effect.

{
  duration: 1200,
  easing: "easeInOutQuad",
  force: false,
  intervalTime: 5,
  endCallback: undefined
};

You Might Be Interested In:


Leave a Reply