IntersectionObserver BTS
IntersectionObserver tracks how a target node intersects a reference area, accounting for clipping by ancestor nodes. Use it to detect when a node becomes visible or leaves the visible area.
Instance method
IntersectionObserver.relativeTo()
Select the reference node with a #id selector.
IntersectionObserver.relativeToViewport()
Use the LynxView viewport as the reference area.
IntersectionObserver.relativeToScreen()
Use the screen as the reference area.
IntersectionObserver.observe()
Select the target node with a #id selector and register a callback.
IntersectionObserver.disconnect()
Stop observing all target nodes.
Example
This example observes how #targetNode intersects #refNode in the current LynxView.
Call observer.disconnect() when you no longer need to observe the target.
Precautions
- Call
relativeTo()andobserve()after the reference and target nodes have been created. - On Android, child nodes of a horizontally scrolling
scroll-viewdo not trigger callbacks while scrolling. Setflattentofalseon the child node to trigger them.
Compatibility
LCD tables only load in the browser