Skip to content
Balázs Galambosi edited this page Dec 15, 2015 · 11 revisions

Installing

npm install smoothscroll-for-websites
bower install --save smoothscroll-for-websites

Or grab the latest version from cdnjs (minified version also available): https://cdnjs.com/libraries/smoothscroll

Public API

You set options by passing your custom options in an object:

SmoothScroll({ stepSize: 20 })

To disable on a certain site call destroy as early as possible:

SmoothScroll.destroy()

Options

{
    // Scrolling Core
    animationTime    : 400, // [ms]
    stepSize         : 100, // [px]

    // Acceleration
    accelerationDelta : 50,  // 50
    accelerationMax   : 3,   // 3

    // Keyboard Settings
    keyboardSupport   : true,  // option
    arrowScroll       : 50,    // [px]

    // Pulse (less tweakable)
    // ratio of "tail" to "acceleration"
    pulseAlgorithm   : true,
    pulseScale       : 4,
    pulseNormalize   : 1,

    // Other
    touchpadSupport   : false, // ignore touchpad by default
    fixedBackground   : true, 
    excluded          : ''    
}

If you want to set custom options after you load the library (sync version):

<script src="SmoothScroll.js"></script>
<script>SmoothScroll({ keyboardSupport: false })</script>

If you want to set custom options before you load the library (async version):

<script>window.SmoothScrollOptions = { keyboardSupport: false }</script>
<script async src="SmoothScroll.js"></script>

Or using an async loading library

window.SmoothScrollOptions = { keyboardSupport: false } 
loadLibrary('SmoothScroll.js') // your async loading method of choice
Clone this wiki locally