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
var element = document.scrollingElement;
Exemple
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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scrollingElement |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support