diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/document/scrollingelement/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/document/scrollingelement/index.html')
-rw-r--r-- | files/zh-cn/web/api/document/scrollingelement/index.html | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/document/scrollingelement/index.html b/files/zh-cn/web/api/document/scrollingelement/index.html new file mode 100644 index 0000000000..9f6e68e342 --- /dev/null +++ b/files/zh-cn/web/api/document/scrollingelement/index.html @@ -0,0 +1,97 @@ +--- +title: Document.scrollingElement +slug: Web/API/Document/scrollingElement +translation_of: Web/API/Document/scrollingElement +--- +<div>{{APIRef("DOM")}}</div> + +<p><strong><code>scrollingElement</code></strong> ( {{domxref("Document")}} 的只读属性)返回滚动文档的 {{domxref("Element")}} 对象的引用。 在标准模式下, 这是文档的根元素, {{domxref("document.documentElement")}}.</p> + +<p>当在怪异模式下, <code>scrollingElement</code> 属性返回 HTML <code>body</code> 元素(若不存在返回 null )。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var <var>element</var> = document.scrollingElement;</pre> + +<h2 id="示例">示例</h2> + +<pre class="brush: js">var scrollElm = document.scrollingElement; +scrollElm.scrollTop = 0; +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('CSSOM View','#dom-document-scrollingelement','scrollingElement')}}</td> + <td>{{Spec2('CSSOM View')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(44.0)}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("48.0")}}<sup>[1]</sup></td> + <td>{{CompatNo}}</td> + <td>33.0</td> + <td>9.0</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>36</td> + <td>9.0</td> + <td>{{CompatChrome(44.0)}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] This feature was initially implemented in Gecko 47.0 {{geckoRelease("47.0")}} behind the preference <code>dom.document.scrollingElement.enabled</code>, defaulting to <code>true</code> on Nightly builds and <code>false</code> otherwise. In Gecko 48.0 {{geckoRelease("48.0")}} the feature got enabled by default and the preference removed.</p> |