getLocationOffset
Commons
stable
Computes the cumulative offset of an element from the document edge by walking its offsetParent chain, or returns a raw numeric offset (negated in RTL horizontal mode).
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- targetrequisany
- A number (returned as-is), a CSS selector string, a Vue component instance, or an HTMLElement. Numbers in horizontal RTL mode are negated.
- horizontalboolean
- When true, measures the horizontal (left) offset instead of the vertical (top) offset.
- rtlboolean
- When true and horizontal is true, a numeric target is negated to account for RTL document direction.
API
Valeur de retour
La valeur retournée par cet util.
- The cumulative pixel offset of the element from the document edge (top by default, left in horizontal mode).
Usage
Exemples
Extraits de code prêts à coller.
Vertical offset of an element