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.
var element = document.scrollingElement;
var scrollElm = document.scrollingElement; scrollElm.scrollTop = 0;
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module The definition of 'scrollingElement' in that specification. | Working Draft | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 44 | Yes | 48
|
No | 31 | 9 |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 44 | 44 | Yes | Yes | 31 | 9 | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/scrollingElement