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 potentially scrollable, otherwise it returns null.

Syntax

var element = document.scrollingElement;

Example

var scrollElm = document.scrollingElement;
scrollElm.scrollTop = 0;

Specifications

Specification
CSSOM View Module (CSSOM View)
# dom-document-scrollingelement

Browser compatibility

BCD tables only load in the browser