diff options
author | MDN <actions@users.noreply.github.com> | 2022-02-12 00:56:58 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2022-02-12 00:56:58 +0000 |
commit | 01f082cdc9c06afc6dfa7573345590ea9eec8714 (patch) | |
tree | 55430234aa4a832b625c7879916dffcd025c13f1 /files/zh-cn/conflicting/web/api/document/fullscreenchange_event/index.html | |
parent | bf9c159c4b69bafea62616ab67074da0e9e96f0a (diff) | |
download | translated-content-01f082cdc9c06afc6dfa7573345590ea9eec8714.tar.gz translated-content-01f082cdc9c06afc6dfa7573345590ea9eec8714.tar.bz2 translated-content-01f082cdc9c06afc6dfa7573345590ea9eec8714.zip |
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/conflicting/web/api/document/fullscreenchange_event/index.html')
-rw-r--r-- | files/zh-cn/conflicting/web/api/document/fullscreenchange_event/index.html | 67 |
1 files changed, 67 insertions, 0 deletions
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 +--- +<div>{{ApiRef("Fullscreen API")}}</div> + +<p>{{domxref("Document")}}接口的<strong><code>onfullscreenchange</code> </strong>属性是 {{event("fullscreenchange")}} 事件的处理器,该处理器在文档进入或者退出全屏模式的时候立即触发。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox notranslate"><var>targetDocument</var>.onfullscreenchange = <var>fullscreenChangeHandler</var>; +</pre> + +<h3 id="Value">Value</h3> + +<p>每当文档接收到{{event("fullscreenchange")}} 事件时都会调用该事件处理程序,它表明文档正在进入或退出全屏模式。</p> + +<h2 id="使用说明">使用说明</h2> + +<p><code>fullscreenchange</code>事件不会直接说明文档当前是进入还是退出全屏模式,因此你的事件处理程序应查看{{domxref("Document.fullscreenElement")}}的值。 如果为null,则该事件表示已退出全屏模式; 否则,指定的元素将接管屏幕。</p> + +<h2 id="示例">示例</h2> + +<pre class="brush: js notranslate">document.onfullscreenchange = function ( event ) { + console.log("FULL SCREEN CHANGE") +}; +document.documentElement.onclick = function () { + // requestFullscreen() 方法必须在一个事件处理器的方法体里执行,否则将会失败 + document.documentElement.requestFullscreen(); +} +</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("Fullscreen", "#handler-document-onfullscreenchange", "onfullscreenchange")}}</td> + <td>{{Spec2("HTML WHATWG")}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{Compat("api.Document.onfullscreenchange")}}</p> + +<h2 id="相关文章">相关文章</h2> + +<ul> + <li><a href="/zh-CN/docs/Web/API/Fullscreen_API">Fullscreen API</a></li> + <li><a href="/zh-CN/docs/Web/API/Fullscreen_API/Guide">Guide to the Fullscreen API</a></li> + <li>{{event("fullscreenchange")}}</li> + <li>{{domxref("Document.onfullscreenerror")}}</li> +</ul> |