useIntersectionObserver API
API reference for the useIntersectionObserver composable.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| useIntersectionObserver | System |
| useResizeObserver | System |
| useMutationObserver | System |
Functions
useIntersectionObserver
(target: MaybeElementRef, callback: (entries: IntersectionObserverEntry[]) => void, options?: IntersectionObserverOptions) => UseIntersectionObserverReturnA composable that uses the Intersection Observer API to detect when an element is visible in the viewport.
useElementIntersection
(target: MaybeElementRef, options?: IntersectionObserverOptions) => UseElementIntersectionReturnA convenience composable that uses the Intersection Observer API to detect when an element is visible in the viewport.
Options
immediate
boolean | undefinedonce
boolean | undefinedroot
Element | null | undefinedrootMargin
string | undefinedthreshold
number | number[] | undefinedProperties
isActive
Readonly<Ref<boolean, boolean>>Whether the observer is currently active (created and observing)
isIntersecting
Readonly<Ref<boolean, boolean>>Whether the target element is currently intersecting with the viewport