pointercancel event is fired when the browser determines that there are unlikely to be any more pointer events, or if after the pointerdown event is fired, the pointer is then used to manipulate the viewport by panning, zooming, or scrolling.

冒泡 Yes
可取消 No
接口 PointerEvent
事件处理程序特性 onpointercancel

Some examples of situations that will trigger a pointercancel event:

  • A hardware event occurs that cancels the pointer activities. This may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device.
  • The device's screen orientation is changed while the pointer is active.
  • The browser decides that the user started pointer input accidentally. This can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events.
  • touch-action CSS property prevents the input from continuing.

之后 pointercancel event is fired, the browser will also send pointerout followed by pointerleave .

范例

使用 addEventListener() :

const para = document.querySelector('p');
para.addEventListener('pointercancel', (event) => {
  console.log('Pointer event cancelled');
});
					

使用 onpointercancel 事件处理程序特性:

const para = document.querySelector('p');
para.onpointercancel = (event) => {
  console.log('Pointer event cancelled');
};
					

规范

规范 状态
指针事件 过时

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
pointercancel event Chrome 55 Edge 12
12
不支持 12 — 79 Alternate Name
Alternate Name Uses the non-standard name: mspointercancel
Firefox 59
59
Disabled ). To change preferences in Firefox, visit
IE 11
11
10 Alternate Name
Alternate Name Uses the non-standard name: mspointercancel
Opera ? Safari No WebView Android 55 Chrome Android 55 Firefox Android 29 Opera Android ? Safari iOS No Samsung Internet Android 6.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

用户必须明确启用此特征。

用户必须明确启用此特征。

使用非标名称。

另请参阅

元数据

  • 最后修改: