pointerlockchange

  • Revision slug: Mozilla_event_reference/pointerlockchange
  • Revision title: pointerlockchange
  • Revision id: 323121
  • Created:
  • Creator: louisremi
  • Is current revision? No
  • Comment

Revision Content

The pointerlockchange event is fired when the pointer is locked/unlocked.

General info

Specification
Pointer Lock
Interface
Event
Bubbles
Yes
Cancelable
No
Target
Document
Default Action
None

Properties

{{OpenEventProperties()}}{{CloseEventProperties()}}

Example

// Note that the API is still vendor-prefixed in browsers implementing it
document.addEventListener("pointerlockchange", function( event ) {

    // The target of the event is always the document,
    // but it is possible to retrieve the locked element through the API
    document.pointerLockElement;

});

See also

Revision Source

<p>The <code>pointerlockchange</code> event is fired when the pointer is locked/unlocked.</p>
<h2 id="General_info">General info</h2>
<dl>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Specification</dt>
  <dd style="margin: 0 0 0 120px;">
    <a class="external" href="http://www.w3.org/TR/pointerlock/#pointerlockchange-and-pointerlockerror-events">Pointer Lock</a></dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Interface</dt>
  <dd style="margin: 0 0 0 120px;">
    Event</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Bubbles</dt>
  <dd style="margin: 0 0 0 120px;">
    Yes</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Cancelable</dt>
  <dd style="margin: 0 0 0 120px;">
    No</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Target</dt>
  <dd style="margin: 0 0 0 120px;">
    Document</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Default Action</dt>
  <dd style="margin: 0 0 0 120px;">
    None</dd>
</dl>
<h2 id="Properties">Properties</h2>
<p>{{OpenEventProperties()}}{{CloseEventProperties()}}</p>
<h2 id="Example">Example</h2>
<pre class="brush:js;">
// Note that the API is still vendor-prefixed in browsers implementing it
document.addEventListener("pointerlockchange", function( event ) {

    // The target of the event is always the document,
    // but it is possible to retrieve the locked element through the API
    document.pointerLockElement;

});
</pre>
<h2 id="Related_Events">Related Events</h2>
<ul>
  <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla_event_reference/pointerlockerror"><code>pointerlockerror</code></a></li>
</ul>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/API/Pointer_Lock_API">Using Pointer Lock API</a></li>
</ul>
Revert to this revision