# IntersectionObserver.observe(string targetSelector, function callback)
with Promise style call: Not supported
Mini Program plugin: Support
Specify the target node and start listening for changes in the intersection state
# parameter
# string targetSelector
Selector
# function callback
A callback function that listens for intersecting state changes
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
id | string | node ID |
dataset | Record.<string, any> | Node Custom Data Properties |
intersectionRatio | number | Intersecting proportion |
intersectionRect | Object | Boundary of intersecting region |
boundingClientRect | Object | Target boundary |
relativeRect | Object | Boundary of reference area |
time | number | Time Stamp for Intersection Detection |
res.intersectionRect Structure
attribute | type | Introductions |
---|---|---|
left | number | Left boundary |
right | number | Right boundary |
top | number | Upper boundary |
bottom | number | Lower boundary |
width | number | width |
height | number | height |
res.boundingClientRect Structure
attribute | type | Introductions |
---|---|---|
left | number | Left boundary |
right | number | Right boundary |
top | number | Upper boundary |
bottom | number | Lower boundary |
width | number | width |
height | number | height |
res.relativeRect Structure
attribute | type | Introductions |
---|---|---|
left | number | Left boundary |
right | number | Right boundary |
top | number | Upper boundary |
bottom | number | Lower boundary |