aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/document/hidden/index.html
blob: f9db5934d8d2a47269e26949730c1176a472a466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: Document.hidden
slug: Web/API/Document/hidden
translation_of: Web/API/Document/hidden
---
<p>{{ ApiRef("DOM") }}</p>

<p><code><strong>Document.hidden</strong></code> (只读属性)返回布尔值,表示页面是(true)否(false)隐藏。</p>

<h2 id="语法">语法</h2>

<pre class="syntaxbox">var <em>string</em> = document.hidden</pre>

<h2 id="例子">例子</h2>

<pre class="brush:js;">document.addEventListener("visibilitychange", function() {
  console.log( document.hidden );
  // Modify behavior...
});</pre>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th>Specification</th>
   <th>Status</th>
   <th>Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Page Visibility API','#dom-document-hidden', 'Document.hidden')}}</td>
   <td>{{Spec2('Page Visibility API')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<article>
<p>{{Compat("api.Document.hidden")}}</p>
</article>