Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/usehooks-ts.ts>useIntersectionObserver

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useIntersectionObserver
Deprecated
Deprecated

Use the new signature with an unique option object instead. Custom hook for tracking the intersection of a DOM element with its containing element or the viewport.

import { useIntersectionObserver } from "https://deno.land/x/netzo@0.4.72/deps/usehooks-ts.ts";

Examples

const targetRef = useRef(null); const options = { threshold: 0.5 }; const entry = useIntersectionObserver(targetRef, options); // Access the intersection details from the entry variable.

Parameters

elementRef: RefObject<Element>
  • The ref object for the DOM element to observe.
legacyOptions: IntersectionObserverOptions
  • The options for the Intersection Observer (optional).

Returns

IntersectionObserverEntry | undefined

The intersection observer entry representing the state of the intersection.