--- title: 'Document: pointerlockchange event' slug: Web/API/Document/pointerlockchange_event translation_of: Web/API/Document/pointerlockchange_event ---
pointerlockchange
事件当指针解锁或者被锁定时触发
冒泡 | Yes |
---|---|
可取消 | No |
接口 | {{domxref("Event")}} |
Event handler property | {{domxref("Document/onpointerlockchange", "onpointerlockchange")}} |
使用 addEventListener()
:
document.addEventListener('pointerlockchange', (event) => { console.log('Pointer lock changed'); });
使用 onpointerlockchange
事件处理程序属性
document.onpointerlockchange = (event) => { console.log('Pointer lock changed'); };
Specification | Status |
---|---|
{{SpecName('Pointer Lock', '#pointerlockchange-and-pointerlockerror-events')}} | {{Spec2('Pointer Lock')}} |
{{Compat("api.Document.pointerlockchange_event")}}