備忘録的プログラミングリファレンス

touchcancel ( ontouchcancel )イベント

 touchcancel ( ontouchcancel )イベントは、タッチベースのデバイスにおいて何らかのエラーでタッチイベントが中断すると発生するイベントです。

 タッチイベントにおいて「エラー」が発生した場合に、touchcancel イベントによってコードをクリーンアップすることができます。

*Safari、Operaブラウザでは対応していません。

touchcancel ( ontouchcancel )イベント
document.getElementById("contena").addEventListener("touchcancel", (event)=>{
	console.log( event );
});

詳しくは Example を参照してください

ページ内 Index

構文(Syntax)

in HTML

<tagelement ontouchcancel="function()">

in JavaScript

object.ontouchcancel = function(){ };

object.addEventListener("touchcancel", script_);

備考(Remarks)

BubblesYes
CancelableYes
InterfaceTouchEvent
Supported HTML ElementsALL HTML elements

Example

 touchcancel ( ontouchcancel )イベントの例です。

 タッチデバイスでの操作がキャンセルされると発生するイベントです。この例では、どのタイミングで touchcancel、touchstart、touchend、touchmove の各イベントが発生するかを確かめるためにタッチデバイスに関するイベントを網羅しています。

確認ボタンをクリックしてください。以下のHTML,CSS,Scriptコード例が実行されます。