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.

La propriété en lecture seule scrollingElement de l'interface Document renvoie une référence à l'élément qui fait défiler le document. En mode standard, il s'agit de l'élément racine du document, document.documentElement.

En mode quirks, l'attribut scrollingElement renvoie l'élément HTML body s'il existe et est potentiellement défilable, sinon il renvoie null.

Syntaxe

js
var element = document.scrollingElement;

Exemple

js
var scrollElm = document.scrollingElement;
scrollElm.scrollTop = 0;

Spécifications

Specification
CSSOM View Module
# dom-document-scrollingelement

Compatibilité des navigateurs

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