window.IntersectionObserver
See: IntersectionObserver
Since: v8.1
IntersectionObserver(callback, [options])
Provides a mechanism to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document element.
Throws:
SyntaxErrorIf therootMarginorscrollMarginvalues are invalid.RangeErrorIf anythresholdvalues are outside the range of 0.0 to 1.0.
functionObject{}Elementstring"\"0px\""string"\"0px\""number | Array<number>0root : Element
Gets the root element being used for intersection calculation.
See: IntersectionObserver - root
Since: v8.1
rootMargin : string
Gets the root margin applied to the intersection calculation.
See: IntersectionObserver - rootMargin
Since: v8.1
thresholds : Array<number>
Gets the list of thresholds used for triggering the observer's callback.
See: IntersectionObserver - threshold
Since: v8.1
scrollMargin : string
Gets the scroll margin applied to the scroll container during intersection calculation.
See: IntersectionObserver - scrollMargin
Since: v8.1
observe(target)
Starts observing the specified target element for intersection changes.
Throws:
TypeErrorIf the target is not an instance ofElement.
See: IntersectionObserver - observe
Since: v8.1
Elementunobserve(target)
Stops observing the specified target element.
Throws:
TypeErrorIf the target is not an instance ofElement.
See: IntersectionObserver - unobserve
Since: v8.1
Elementdisconnect()
Disconnects the IntersectionObserver instance from all observed target elements.
See: IntersectionObserver - disconnect
Since: v8.1
takeRecords()
Returns a list of IntersectionObserverEntry objects for all observed elements.
Returns: Array<IntersectionObserverEntry> - An array of IntersectionObserverEntry objects.
See: IntersectionObserver - takeRecords
Since: v8.1