isFixedPosition

Commons
stable

Walks up the DOM ancestry of an element and returns true if any ancestor (including the element itself) has position: fixed in its computed style. Used by overlay and location strategies to decide whether teleport targets need special handling.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

el
HTMLElement
The element from which to start the ancestor walk. When undefined, the function immediately returns false.

API

Valeur de retour

La valeur retournée par cet util.

true when el or any of its offsetParent ancestors has position: fixed; false otherwise.

Usage

Exemples

Extraits de code prêts à coller.

Detect fixed-position ancestors

typescript