Create Custom Scrollbars With Pure JavaScript – scrollBot

Category: Javascript | June 19, 2017
Author:akzhy
Views Total:4,652 views
Official Page:Go to website
Last Update:June 19, 2017
License:MIT

Preview:

Create Custom Scrollbars With Pure JavaScript – scrollBot

Description:

scrollBot is a vanilla JavaScript library that appends a highly customizable scrollbar to your scrollable container.

How to use it:

Put the scrollBot’s script in the document and we’re ready to go.

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

Create a new scrollBot object and specify the target container.

var myDemo = new scrollbot(".container", WIDTH);

Apply your own CSS styles to the custom scrollbar.

var myDemo = new scrollbot(".container",10).setStyle({
      "background":"#202020",
      "z-index":"2"
    },{
      "background":"rgba(0,0,0,0)"
    });

Scroll to a specific position within the scrollable container.

myDemo.setScroll(scrollPosition,duration)

Execute a custom function when scrolling.

myDemo.onScroll(function)

Refresh the scrollbar that is useful in window resize.

myDemo.refresh()

You Might Be Interested In:


Leave a Reply