Option name | Type | Description |
---|---|---|
contentSelector | domelement_or_querystring_or_jqueryobject | Selector or element containing content to be scrolled by the scrollbar |
scrollbarSelector | domelement_or_querystring_or_jqueryobject | Selector or element containing the scrollbar HTML. Expected to contain elements with classes 'js-track'/'track', and 'js-handle'/'handle' |
options | object | An object containing the custom settings for this scrollbar |
NATION.Utils
NATION.EventDispatcher
A JavaScript-powered scrollbar, used to scroll content vertically
Event that fires each time the content position is changed
Event that fires when the scrollbar becomes active (due to long content)
Event that fires when the scrollbar is disabled (content isn't long enough)
Resume listening for user interaction (handle drags, content scrolls, etc)
Stop listening to any form of user interaction (handle drags, content scrolls, etc)
Set the scroll position back to the top of the content
Option name | Type | Description |
---|---|---|
maintainPosition | Boolean | Set to true if the handle and content should maintain their relative current scroll position, percentage-wise |
Repositions the scrollbar after the content height was changed
If the position relative to the content's current scroll should be maintained, maintainPosition should be true. Otherwise this will reset the scrollbar, and associated content, back to the top
This method also disables the scrollbar automatically, if the content height has become smaller than the scrollbar height
Option name | Type | Description |
---|---|---|
percentage | Number | A percentage representing how far down the content should be scrolled, from 0 to 1 |
Scroll the content to a passed position, as a percentage between 0 and 1
Returns the current scroll position, as a percentage between 0 and 1