getScrollParent
Commons
stable
Walks the DOM ancestor chain of an element and returns the first parent that has a visible scrollbar (or any potential scroll container when includeHidden is true).
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- elHTMLElement
- The element to start from. When omitted, returns document.scrollingElement.
- includeHiddenbooleanfalse
- When true, elements with overflow: scroll or overflow: auto (even without visible scrollbar) are included. Defaults to false.
API
Valeur de retour
La valeur retournée par cet util.
- The nearest scrollable ancestor, or document.scrollingElement as the document-level fallback.
Usage
Exemples
Extraits de code prêts à coller.
Find the scrollable container of a tooltip anchor