aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/document/pointerlockchange_event/index.html
blob: 86a47a3f06c93e1b4bd3421e87be7cd3c294ed6c (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: 'Document: pointerlockchange event'
slug: Web/API/Document/pointerlockchange_event
translation_of: Web/API/Document/pointerlockchange_event
---
<div>{{APIRef}}</div>

<p><code>pointerlockchange</code> 事件当指针解锁或者被锁定时触发</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">冒泡</th>
   <td>Yes</td>
  </tr>
  <tr>
   <th scope="row">可取消</th>
   <td>No</td>
  </tr>
  <tr>
   <th scope="row">接口</th>
   <td>{{domxref("Event")}}</td>
  </tr>
  <tr>
   <th scope="row">Event handler property</th>
   <td>{{domxref("Document/onpointerlockchange", "onpointerlockchange")}}</td>
  </tr>
 </tbody>
</table>

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

<p>使用 <code>addEventListener()</code>:</p>

<pre class="brush: js notranslate">document.addEventListener('pointerlockchange', (event) =&gt; {
  console.log('Pointer lock changed');
});</pre>

<p>使用 <code>onpointerlockchange</code> 事件处理程序属性</p>

<pre class="brush: js notranslate">document.onpointerlockchange = (event) =&gt; {
  console.log('Pointer lock changed');
};</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('Pointer Lock', '#pointerlockchange-and-pointerlockerror-events')}}</td>
   <td>{{Spec2('Pointer Lock')}}</td>
  </tr>
 </tbody>
</table>

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

<div class="hidden">此页上的兼容性表是从结构化数据生成的。如果你想对数据有所贡献,请查看https://github.com/mdn/browser-compat-data并向我们发送请求。</div>

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

<h2 id="参考">参考</h2>

<ul>
 <li><a href="/en-US/docs/API/Pointer_Lock_API">Using Pointer Lock API</a></li>
</ul>