Skip to main content

Accessors

note

All Module accessors are available in this class.

axis​

Type: "x" | "y"

Scrolling direction.

const instance = new Scrollbar();

instance.axis; // returns "x" or "y"

container​

Type: Window | HTMLElement

The element to which the scrollbar is applied.

const instance = new Scrollbar();

instance.container; // returns Window or HTMLElement

outer​

Type: HTMLElement

Scrollbar outer element.

const instance = new Scrollbar();

instance.outer; // returns the scrollbar wrapper element

parent​

Type: HTMLElement

The element where the scrollbar is appended. If parent is not set, it defaults to container or document.body (if applied to window).

const instance = new Scrollbar();

instance.parent; // returns the element inside which scrollbar is appended

scrollableSize​

Type: number

Returns the total scrollable distance.

const instance = new Scrollbar();

instance.scrollableSize; // returns container scrollable size

scrollElement​

Type: HTMLElement

The actual scrollable element. Returns document.documentElement for window, otherwise the container itself.

const instance = new Scrollbar();

instance.scrollElement; // returns target scrollable element

scrollSize​

Type: number

Returns the total scroll width/height of the content.

const instance = new Scrollbar();

instance.scrollSize;

scrollValue​

Type: number

Returns scrollTop or scrollLeft of the scrollable element.

const instance = new Scrollbar();

instance.scrollValue; // returns scrollTop or scrollLeft value

thumb​

Type: HTMLElement

Scrollbar thumb element (draggable handle).

const instance = new Scrollbar();

instance.thumb; // returns the scrollbar lever element

thumbSize​

Type: number

Returns the current thumb size.

const instance = new Scrollbar();

instance.thumbSize; // returns size of the scrollbar lever element

track​

Type: HTMLElement

Scrollbar track element (the container of the thumb).

const instance = new Scrollbar();

instance.track; // returns the scrollbar track container

trackSize​

Type: number

Returns the current track size.

const instance = new Scrollbar();

instance.trackSize; // returns size of the scrollbar track container