Web APIs

IntersectionObserver()

Try the free JavaScript compiler

Creates an asynchronous geometric intersection observer. Options include root, rootMargin and threshold.

Formal Syntax & Structure

javascript syntaxjavascript
new IntersectionObserver(callback, [options])

Parameters & Attributes

NameTypeDescription
callbackfunctionReceives entries and observer.
optionsIntersectionObserverInitRoot and thresholds.

Return Value

IntersectionObserver

Observer instance.

Working Example

Example Snippetjavascript
(async () => {const o=new IntersectionObserver(()=>{}, {threshold:[0.75,0.25]});console.log(JSON.stringify(o.thresholds),o.root===null);o.disconnect();})()
JavaScript Reference