Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

requestPointerLock method

Requests that the pointer be locked to the target element.

Syntax

Element.requestPointerLock();

Parameters

This method has no parameters.

Return value

This method does not return a value.

Standards information

Remarks

A pointerlockchange event will fire if the request was successful; otherwise a pointerlockerror event will fire. The pointer locked element can be accessed by document.pointerLockElement.

When in pointerlock state:

  • The pointer locked element is the target of all mouse / pointer events,
  • The mouse cursor is hidden,
  • All coordinate-related attributes such as screenX or clientX remain constant, and
  • movementX / movementY is not clamped by window or screen boundaries.

See also

Element
exitPointerLock

 

 

Show:
© 2017 Microsoft