IntersectionObserverEntry

Baseline 广泛可用 *

此功能已成熟,并可在多种设备和浏览器版本上运行。自 2019 年 3 月以来,它已在所有浏览器中可用。

* 此特性的某些部分可能存在不同级别的支持。

IntersectionObserverEntry 接口是 Intersection Observer API 的一部分,它描述了在特定过渡时刻目标元素与其根容器的交叉情况。

IntersectionObserverEntry 的实例会传递给 IntersectionObserver 回调的 entries 参数;否则,只能通过调用 IntersectionObserver.takeRecords() 来获取这些对象。

实例属性

IntersectionObserverEntry.boundingClientRect 只读

DOMRectReadOnly 的形式返回目标元素的边界矩形。边界的计算方法参见 Element.getBoundingClientRect() 的文档。

IntersectionObserverEntry.intersectionRatio 只读

返回 intersectionRect 相对于 boundingClientRect 的比例。

IntersectionObserverEntry.intersectionRect 只读

返回一个 DOMRectReadOnly 对象,表示目标元素的可见区域。

IntersectionObserverEntry.isIntersecting 只读

一个布尔值,如果目标元素与 intersection observer 的根交叉,则为 true。如果此值为 true,则 IntersectionObserverEntry 描述了过渡到交叉状态;如果此值为 false,则表示您知道过渡是从交叉状态到非交叉状态。

IntersectionObserverEntry.rootBounds 只读

返回 intersection observer 根的 DOMRectReadOnly 对象。

IntersectionObserverEntry.target 只读

其与根元素的交叉发生变化的 Element

IntersectionObserverEntry.time 只读

一个 DOMHighResTimeStamp,表示记录交叉时间的时间戳,相对于 IntersectionObservertime origin

实例方法

此接口没有方法。

规范

规范
交集观察器
# intersection-observer-entry

浏览器兼容性