Element.requestPointerLock()
Element.requestPointerLock() 方法允许您异步地请求将鼠标指针锁定在指定元素上。
若想追踪请求成功还是失败,则需要在 Document 级别监听 pointerlockchange 和 pointerlockerror (en-US) 事件。
语法
instanceOfElement.requestPointerLock();
规范
| Specification |
|---|
| Pointer Lock 2.0 # dom-element-requestpointerlock |
浏览器兼容性
BCD tables only load in the browser