lynx: createIntersectionObserver() static method
lynx.createIntersectionObserver() creates an IntersectionObserver. Use options to control when callbacks run.
grammar
Parameters
component
Pass { componentId: '' } to find the target and reference nodes in the current LynxView. With a component ID, Lynx searches that component first and falls back to the whole LynxView if needed.
options
thresholdsis a list of intersection ratios in[0, 1]. The default is[0]. After the first check, a callback runs when the ratio reaches, leaves, or crosses a threshold.initialRatiosets the baseline for the first check. It ranges from0to1and defaults to0. By default, the first check triggers the callback only if the ratio is greater thaninitialRatio. WhenenableIntersectionObserverInitialRatioCompatibilityis enabled (available since Lynx 4.5), the first ratio must differ frominitialRatioand meet or exceed at least one configured threshold.observeAllis reserved on Android, iOS, and Harmony. The default isfalse.
return value
An IntersectionObserver object.
Example
This example observes how #targetNode intersects #refNode in the current LynxView.
Call observer.disconnect() when you no longer need to observe the target.
Compatibility
LCD tables only load in the browser