blob: eb3ecd19999e86796d3d2f426782f11c00ccdd38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
---
title: Document.scrollingElement
slug: Web/API/Document/scrollingElement
browser-compat: api.Document.scrollingElement
translation_of: 'Web/API/Document/scrollingElement'
---
{{APIRef("DOM")}}
La propriété en lecture seule **`scrollingElement`** de l'interface [`Document`](/fr/docs/web/api/document) renvoie une référence à l'[élément](/fr/docs/web/api/element) qui fait défiler le document. En mode standard, il s'agit de l'élément racine du document, [`document.documentElement`](/fr/docs/web/api/document/documentelement).
En mode quirks, l'attribut `scrollingElement` renvoie l'élément HTML `body` s'il existe et est [potentiellement défilable](https://drafts.csswg.org/cssom-view/#potentially-scrollable), sinon il renvoie `null`.
## Syntaxe
```js
var element = document.scrollingElement;
```
## Exemple
```js
var scrollElm = document.scrollingElement;
scrollElm.scrollTop = 0;
```
## Spécifications
{{Specifications}}
## Compatibilité du navigateur
{{Compat}}
|