Class: scrllbr

scrllbr

Cross-browser custom scrollbar

new scrllbr(options){msk}

Initializes a new scrllbr instance.
Name Type Description
options Object Options used to customize the scrllbr
Name Type Default Description
parent * document.body optional Element which the scrllbr's contianer element is appended
id String optional The id of the instance. Auto-generated when not provided
type String scrllbr.VERTICAL optional The type of scrllbr to create. Can be scrllbr.VERTICAL, scrllbr.HORIZONTAL or scrllbr.OMNI.
attr Object optional Attributes to apply to the scrllbr's container element.
css Object optional CSS Properties to apply to the scrllbr's container element
content Object optional Options used to create the scrllbr's content element
Name Type Default Description
attr.class String 'scrllbr-content' optional
track Object optional Options used to create the scrollbar track
Name Type Default Description
attr.class String 'scrllbr-track' optional
thumb Object optional Options used to create scrollbar thumb
Name Type Default Description
attr.class String 'scrllbr-thumb' optional
Returns:
Type Description
msk A new scrllbr instance.

Requires

Members

readonlyelElement

The container element associated with this instance

readonlyrangeNumber

The range of the scrllr thumb in pixels

scrollNumber

The current scroll position as a number between 0 and 1

targetElement

The element to which the scrllbr is attached

readonlytypeString

Indicates the orientation of the scrllbr instance

Methods

staticscrllbr.getElInstance(el){scrllbr}

returns the scrllbr instance associated with the provided element's id attribute
Name Type Description
el Element The element with the lookup id
Returns:
Type Description
scrllbr The associate scrllbr, if it exists

staticscrllbr.getInstance(id){scrllbr}

returns the scrllbr instance associated with the id
Name Type Description
id String The lookup id
Returns:
Type Description
scrllbr The associate scrllbr, if it exists
Attach scroll listeners to the target
Updates thumb when the target is mutated
Updates thumb position when the target is scrolled

removeListeners()

Remove scroll listeners to the target
Add listeners to enable manual scrolling
Remove manuak scroll listeners
Handle track interactions
Update tha target scroll position based on user action