We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

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 (or null if it does not exist).

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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support44 Yes

48

47 — 481

No319
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support4444 Yes Yes319 ?

1. 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.

Document Tags and Contributors

Last updated by: fscholz,