The lynx.createIntersectionObserver
method can be used to create an IntersectionObserver
object. The object behavior can be customized by passing in parameters. Once the object is created, it cannot be modified.
For front-end custom component
or card
instances, the target node and reference node are searched first in this component
. If not found, the global search is performed.
Specify the behavior of IntersectionObserver
objects:
thresholds
: The valid range of each array element is [0, 1]
, specifying a threshold list for intersection state changes. When the intersection ratio of the target node and the reference node passes one of the thresholds, a callback is triggered, and the old intersection ratio is represented. and the new intersection ratio is on either side of the threshold or the intersection ratio is equal to the thresholdinitialRatio
: The valid range is [0, 1]
, which specifies the threshold for triggering the callback when detected for the first time. The callback is triggered when the intersection ratio of the first detection is greater than the threshold.observeAll
: Specify whether to observe multiple target nodes at the same timeYou can observe changes in the intersection status of the target node and the reference node through the following three steps:
IntersectionObserver
object and specify a threshold list for intersection state changesrelativeTo*
method of the IntersectionObserver
object to specify the reference nodeobserve
method of the IntersectionObserver
object to specify the target node and callbackdisconnect
method of the IntersectionObserver
object to clear the target node and callback