gotpointercapture
イベントは、要素が setPointerCapture()
を使用してポインターをキャプチャしたときに発生します。
バブリング | なし |
---|---|
キャンセル可能 | いいえ |
インターフェイス | PointerEvent |
イベントハンドラープロパティ | ongotpointercapture |
例
この例は <p>
要素を取得し、 gotpointercapture
イベントを待ち受けします。 setPointerCapture()
を pointerdown
イベントの要素上で呼び出し、 gotpointercapture
を発生させます。
const para = document.querySelector('p');
document.addEventListener('gotpointercapture', () => {
console.log('I\'ve been captured!')
});
para.addEventListener('pointerdown', (event) => {
para.setPointerCapture(event.pointerId);
});
同じ例ですが、 ongotpointercapture
イベントハンドラーを使用して行います。
const para = document.querySelector('p');
document.ongotpointercapture = () => {
console.log('I\'ve been captured!')
};
para.addEventListener('pointerdown', (event) => {
para.setPointerCapture(event.pointerId);
});
仕様書
仕様書 | 状態 |
---|---|
Pointer Events | 廃止 |
ブラウザーの対応
BCD tables only load in the browser
関連情報
- 関連イベント
ongotpointercapture
イベントハンドラープロパティHTMLElement
を対象としたこのイベント:gotpointercapture
イベント