Skip to main content
Version: 23.8.0

ElementHandle.isIntersectingViewport() 方法

¥ElementHandle.isIntersectingViewport() method

如果元素在当前视口中可见,则解析为 true。如果一个元素是 SVG,我们会检查 svg 所有者元素是否在视口中。参见 https://crbug.com/963246

¥Resolves to true if the element is visible in the current viewport. If an element is an SVG, we check if the svg owner element is in the viewport instead. See https://crbug.com/963246.

签名

¥Signature

class ElementHandle {
isIntersectingViewport(
this: ElementHandle<Element>,
options?: {
threshold?: number;
},
): Promise<boolean>;
}

参数

¥Parameters

范围

类型

描述

this

ElementHandle<元素>

options

{ threshold?: number; }

(可选的)0(无交叉)和 1(完全交叉)之间交叉的阈值。默认为 1。

Returns:

Promise<boolean>