requestPointerLock() in javascript

requestPointerLock() method in javascript

requestPointerLock() method is used to lock the mouse pointer on the specific element.

It is supported only on firefox and chrome browsers.

Example 1- Check browser for support

Try Yourself

In the above example it checks whether the browser support requestPointerLock method, if it is supports it returns true else false.

Example 2 - Activating requestPointerLock to hide mouse pointer

Try Yourself

exitPointerLock() method in javascript

exitPointerLock() method is used to unlock the mouse pointer which was locked by requestPointerLock.

Example

Try Yourself