此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

VisualViewport.offsetTop

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2021年8月⁩.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

VisualViewport 接口的只读属性 offsetTop 返回视觉视口的顶部相对于布局视口的顶部的偏移量,以 CSS 像素为单位。

语法

var offsetTop = VisualViewport.offsetTop

一个双精度值。

规范

Specification
CSSOM View Module
# dom-visualviewport-offsettop

浏览器兼容性