Document: lostpointercapture event
The lostpointercapture
event is fired when a captured pointer is released.
Bubbles | No |
---|---|
Cancelable | No |
Interface | PointerEvent |
Event handler property | onlostpointercapture |
Examples
This example listens for the lostpointercapture
event, and captures the pointer for an element on pointerdown
. When the user subsequently releases the pointer, the lostpointercapture
event will be fired.
const para = document.querySelector('p'); document.addEventListener('lostpointercapture', () => { console.log('I\'ve been released!') }); para.addEventListener('pointerdown', (event) => { para.setPointerCapture(event.pointerId); });
The same example, but using the onlostpointercapture
event handler property:
const para = document.querySelector('p'); document.onlostpointercapture = () => { console.log('I\'ve been released!') }; para.addEventListener('pointerdown', (event) => { para.setPointerCapture(event.pointerId); });
Specifications
Specification |
---|
Pointer Events # the-lostpointercapture-event |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
lostpointercapture_event |
57 |
17 |
59 |
No |
44 |
13 |
57 |
57 |
79 |
43 |
13 |
7.0 |
See also
- Related events
-
GlobalEventHandlers.onlostpointercapture
event handler property - This event on
HTMLElement
targets:lostpointercapture
event
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/lostpointercapture_event