getOffsetPosition

Commons
stable

Returns the offsetLeft or offsetTop pixel value of a SlideGroup element depending on the axis direction. Returns 0 when the element is undefined.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

isHorizontal
required
boolean
When true, reads offsetLeft (horizontal axis); when false, reads offsetTop (vertical axis).
element
HTMLElement
The target element. When omitted, the function returns 0.

API

Return value

The value returned by this util.

The offsetLeft or offsetTop value in pixels, or 0 if the element is absent.

Usage

Examples

Ready-to-paste usage snippets.

Read slide position in a horizontal track

typescript