getScrollPosition

Commons
stable

Returns the current scroll position (scrollLeft or scrollTop) of a SlideGroup element, with RTL correction applied for horizontal axes.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

isHorizontal
required
boolean
When true, returns the horizontal scroll position (scrollLeft); when false, returns scrollTop.
isRtl
required
boolean
When true and horizontal, normalises the RTL scrollLeft value so that 0 always means "scrolled to the start of content".
element
HTMLElement
The scroll container element. Returns 0 when omitted.

API

Return value

The value returned by this util.

The normalised scroll offset in pixels. Always 0 when element is absent.

Usage

Examples

Ready-to-paste usage snippets.

Read current scroll offset in a slide group

typescript