bindScroll
Commons
stable
Attach a passive scroll listener to the document and all scroll parents of an element. Automatically removes all listeners on Vue scope disposal via onScopeDispose.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- elrequisHTMLElement | undefined
- The reference element whose scroll parents are collected. Pass undefined to bind only the document.
- onScrollrequis(e: Event) => void
- Callback invoked on every scroll event from any of the collected elements.
API
Valeur de retour
La valeur retournée par cet util.
- No return value. Cleanup is automatic via onScopeDispose when called inside a Vue effect scope.
Usage
Exemples
Extraits de code prêts à coller.
Track scroll position in a composable