The scrollingElement
read-only property of the Document
interface returns a reference to the Element
that scrolls the document. In standards mode, this is the root element of the document, document.documentElement
.
When in quirks mode, the scrollingElement
attribute returns the HTML body
element if it exists and is not potentially scrollable, otherwise it returns null.
Syntax
var element = document.scrollingElement;
Example
var scrollElm = document.scrollingElement; scrollElm.scrollTop = 0;
Specifications
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module The definition of 'scrollingElement' in that specification. |
Working Draft | Initial definition |
Browser compatibility
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scrollingElement | Chrome Full support 44 | Edge Full support 12 | Firefox
Full support
48
| IE No support No | Opera Full support 31 | Safari Full support 9 | WebView Android Full support 44 | Chrome Android Full support 44 | Firefox Android Full support Yes | Opera Android Full support 32 | Safari iOS Full support 9 | Samsung Internet Android Full support 4.0 |
Legend
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.
- User must explicitly enable this feature.