Document: lostpointercapture イベント
lostpointercapture イベントは、ポインターのキャプチャが解放されたときに発生します。
| バブリング | なし |
|---|---|
| キャンセル可能 | いいえ |
| インターフェイス | PointerEvent |
| イベントハンドラープロパティ |
onlostpointercapture
|
例
この例は lostpointercapture イベントを待ち受けし、 pointerdown でその要素のためにポインターをキャプチャします。後でユーザーがポインターを解放したとき、 lostpointercapture イベントが発生します。
js
const para = document.querySelector("p");
document.addEventListener("lostpointercapture", () => {
console.log("I've been released!");
});
para.addEventListener("pointerdown", (event) => {
para.setPointerCapture(event.pointerId);
});
同じ例ですが、 onlostpointercapture イベントハンドラーを使用して行います。
js
const para = document.querySelector("p");
document.onlostpointercapture = () => {
console.log("I've been released!");
};
para.addEventListener("pointerdown", (event) => {
para.setPointerCapture(event.pointerId);
});
仕様書
This feature does not appear to be defined in any specification.>ブラウザーの互換性
>関連情報
-
関連イベント
-
GlobalEventHandlers.onlostpointercaptureイベントハンドラープロパティ -
HTMLElementを対象としたこのイベント:lostpointercaptureイベント