From 01f082cdc9c06afc6dfa7573345590ea9eec8714 Mon Sep 17 00:00:00 2001 From: MDN Date: Sat, 12 Feb 2022 00:56:58 +0000 Subject: [CRON] sync translated content --- .../api/document/fullscreenchange_event/index.html | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 files/zh-cn/conflicting/web/api/document/fullscreenchange_event/index.html (limited to 'files/zh-cn/conflicting/web/api') diff --git a/files/zh-cn/conflicting/web/api/document/fullscreenchange_event/index.html b/files/zh-cn/conflicting/web/api/document/fullscreenchange_event/index.html new file mode 100644 index 0000000000..278159eada --- /dev/null +++ b/files/zh-cn/conflicting/web/api/document/fullscreenchange_event/index.html @@ -0,0 +1,67 @@ +--- +title: Document.onfullscreenchange +slug: conflicting/Web/API/Document/fullscreenchange_event +tags: + - API + - Document + - onfullscreenchange +translation_of: Web/API/Document/onfullscreenchange +original_slug: Web/API/Document/onfullscreenchange +--- +
{{ApiRef("Fullscreen API")}}
+ +

{{domxref("Document")}}接口的onfullscreenchange 属性是 {{event("fullscreenchange")}} 事件的处理器,该处理器在文档进入或者退出全屏模式的时候立即触发。

+ +

语法

+ +
targetDocument.onfullscreenchange = fullscreenChangeHandler;
+
+ +

Value

+ +

每当文档接收到{{event("fullscreenchange")}} 事件时都会调用该事件处理程序,它表明文档正在进入或退出全屏模式。

+ +

使用说明

+ +

fullscreenchange事件不会直接说明文档当前是进入还是退出全屏模式,因此你的事件处理程序应查看{{domxref("Document.fullscreenElement")}}的值。 如果为null,则该事件表示已退出全屏模式; 否则,指定的元素将接管屏幕。

+ +

示例

+ +
document.onfullscreenchange = function ( event ) {
+  console.log("FULL SCREEN CHANGE")
+};
+document.documentElement.onclick = function () {
+  // requestFullscreen() 方法必须在一个事件处理器的方法体里执行,否则将会失败
+  document.documentElement.requestFullscreen();
+}
+
+ +

规范

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName("Fullscreen", "#handler-document-onfullscreenchange", "onfullscreenchange")}}{{Spec2("HTML WHATWG")}}Initial definition.
+ +

Browser compatibility

+ +

{{Compat("api.Document.onfullscreenchange")}}

+ +

相关文章

+ + -- cgit v1.2.3-54-g00ecf