From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/document/scrollingelement/index.html | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 files/zh-cn/web/api/document/scrollingelement/index.html (limited to 'files/zh-cn/web/api/document/scrollingelement/index.html') 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 +--- +
{{APIRef("DOM")}}
+ +

scrollingElement ( {{domxref("Document")}} 的只读属性)返回滚动文档的 {{domxref("Element")}} 对象的引用。 在标准模式下, 这是文档的根元素, {{domxref("document.documentElement")}}.

+ +

当在怪异模式下, scrollingElement 属性返回 HTML body 元素(若不存在返回 null )。

+ +

语法

+ +
var element = document.scrollingElement;
+ +

示例

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

规范

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('CSSOM View','#dom-document-scrollingelement','scrollingElement')}}{{Spec2('CSSOM View')}}Initial definition
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(44.0)}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("48.0")}}[1]{{CompatNo}}33.09.0
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidEdgeFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatNo}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatNo}}369.0{{CompatChrome(44.0)}}
+
+ +

[1] This feature was initially implemented in Gecko 47.0 {{geckoRelease("47.0")}} behind the preference dom.document.scrollingElement.enabled, defaulting to true on Nightly builds and false otherwise. In Gecko 48.0 {{geckoRelease("48.0")}} the feature got enabled by default and the preference removed.

-- cgit v1.2.3-54-g00ecf