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 GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
scrollingElement

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support