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
Value / Arguments
Shape of the binding value and each property in the options object.
- handlerrequired(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.
- optionsIntersectionObserverInit
- 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
Modifiers
Dot-suffix modifiers that alter the directive behaviour.
- .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
Examples
Ready-to-paste code snippets for your templates.
Animate on enter (once)
With threshold option