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
要素を返します。body
要素が存在しないか、それがおそらくスクロール可能な場合は null を返します。
構文
文書をスクロールさせる Element
で、通常はルート要素です(標準モードでない場合を除く)。
例
js
const 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.