Document.exitPointerLock()

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

exitPointerLock 方法可异步的解锁鼠标(通过Element.requestPointerLock锁定的)。

追踪是否解锁成功,需要监听pointerlockchangepointerlockerror (en-US) 事件。

语法

document.exitPointerLock();

规范

Specification
Pointer Lock 2.0
# dom-document-exitpointerlock

浏览器兼容性

BCD tables only load in the browser

参见