이 글은 기술 검토가 필요합니다. 도울을 줄 수 있는 방법을 살펴보세요.
이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The scrollingElement
read-only property of the Document
interface returns a reference to the Element
that scrolls the document.
For non-conforming user agents that always use the quirks mode behavior for scrollTop
and scrollLeft
, the scrollingElement
attribute is expected to also always return 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
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 44.0 | (Yes) | 48.0 (48.0)[1] | No support | 33.0 | 9.0 |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | No support | ? | ? | No support | 36 | 9.0 | 44.0 |
[1] This feature was initially implemented in Gecko 47.0 (Firefox 47.0 / Thunderbird 47.0 / SeaMonkey 2.44) behind the preference dom.document.scrollingElement.enabled
, defaulting to true
on Nightly builds and false
otherwise. In Gecko 48.0 (Firefox 48.0 / Thunderbird 48.0 / SeaMonkey 2.45) the feature got enabled by default and the preference removed.