Skip to main content
Version: 24.38.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

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

this

ElementHandle<Element>

options

{ threshold?: number; }

_(可选)_交集的阈值,介于0(无交集)和1(完全交集)之间。默认值为1。

🌐 (Optional) Threshold for the intersection between 0 (no intersection) and 1 (full intersection). Defaults to 1.

返回:

Promise<boolean>