W3cubDocs

/DOM

document.scrollingElement

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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 44 Yes 48
48
47 — 48
Disabled
Disabled From version 47 until version 48 (exclusive): this feature is behind the dom.document.scrollingElement.enabled preference. To change preferences in Firefox, visit about:config.
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