documentdocumentElementscrollTop
document.documentElement.scrollTop is a property of the root HTML element that reports the vertical scroll offset of the document. It returns the number of pixels that the document’s content is scrolled from the top of the page. The root element is typically the html element, and in standards-compliant mode this element is considered the scrolling container for the document.
Cross-browser considerations: in older browsers or in quirks mode, the scrolling element can be document.body instead
Usage and behavior: reading document.documentElement.scrollTop yields the current vertical scroll offset. You can also assign a
Limitations: the usefulness of document.documentElement.scrollTop depends on the browser’s rendering mode and the presence of scrollable
See also: window.pageYOffset, document.body.scrollTop, window.scrollTo.