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

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
scrollingElementChrome Full support 44Edge Full support 12Firefox Full support 48
Full support 48
No support 47 — 48
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.
IE No support NoOpera Full support 31Safari Full support 9WebView Android Full support 44Chrome Android Full support 44Firefox Android Full support YesOpera Android Full support 32Safari iOS Full support 9Samsung Internet Android Full support 4.0


Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.