Document.scrollingElement
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2020.
scrollingElement
(Document
的只读属性)返回滚动文档的 Element
对象的引用。在标准模式下,这是文档的根元素, document.documentElement
。
当在怪异模式下,scrollingElement
属性返回 HTML body
元素(若不存在返回 null)。
语法
var element = document.scrollingElement;
示例
js
var scrollElm = document.scrollingElement;
scrollElm.scrollTop = 0;
规范
Specification |
---|
CSSOM View Module # dom-document-scrollingelement |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scrollingElement |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.