Intersection Observer
The intersection observer provides a method to observe the intersection status between the target node and the reference node and between the target node and the ancestor node. When the intersection status changes, the corresponding callback is triggered.
Developers can observe the changes in the intersection status between the target node and the reference node through the following three steps:
- Call
lynx.createIntersectionObserverto create anIntersectionObserverobject and specify the threshold list of intersection status changes. - Call the
relativeTomethod of theIntersectionObserverobject to specify the reference node. - Call the
observemethod of theIntersectionObserverobject to specify the target node and callback. - Call the
disconnectmethod of theIntersectionObserverobject to clear the target node and callback.
In the following example, the developer monitors whether the parent node and the child node intersect, and outputs the intersecting child node id and the intersection position when they intersect.

For the specific syntax of the intersection observer, please refer to IntersectionObserver.