v-intersect

Directive

Wraps the IntersectionObserver API. Fires a callback each time the element enters or leaves the viewport. Supports .once to disconnect after the first entry and .quiet to skip the initial call on mount.

API

Valeur / Arguments

Forme de la valeur du binding et de chaque propriété de l'objet d'options.

handler
requis
(isIntersecting: boolean, entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void
Callback called on each intersection change. Receives the boolean convenience flag, the raw entries array, and the observer instance.
options
IntersectionObserverInit
Standard IntersectionObserver constructor options (root, rootMargin, threshold). Only available in the object form of the binding.

IntersectionObserver is not available in IE 11 without a polyfill. Origam does not bundle a polyfill — add one via the project if IE 11 support is required.

API

Modificateurs

Modificateurs à suffixe point qui modifient le comportement de la directive.

.once
Disconnects the observer after the element enters the viewport for the first time. Useful for one-shot animations.
.quiet
Suppresses the first callback call that IntersectionObserver fires synchronously on setup, so the handler only fires on real scroll-triggered intersections.

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Animate on enter (once)

vue

With threshold option

vue