跳至主要內容
版本:23.11.1

ElementHandle.isIntersectingViewport() 方法

如果元素在目前的視窗中可見,則解析為 true。如果元素是 SVG,我們會檢查 svg 的擁有者元素是否在視窗中。請參閱https://crbug.com/963246

簽名

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

參數

參數

類型

描述

this

ElementHandle<Element>

options

{ threshold?: number; }

(可選) 介於 0(無交集)和 1(完全交集)之間的交集閾值。預設值為 1。

回傳

Promise<boolean>