touchstart ( ontouchstart )イベント
touchstart ( ontouchstart )イベントは、タッチベースのデバイスでエレメントに触れることで発生するイベントです。
*Safari、Operaブラウザでは対応していません。
document.getElementById("contena").addEventListener("touchstart", (event)=>{
console.log( event );
});
詳しくは Example を参照してください
ページ内 Index
構文(Syntax)
in HTML
<tagelement ontouchstart="function()">
in JavaScript
object.ontouchstart = function(){ };
object.addEventListener("touchstart", script_);
備考(Remarks)
| Bubbles | Yes |
| Cancelable | Yes |
| Interface | TouchEvent |
| Supported HTML Elements | ALL HTML elements |
Example
touchstart ( ontouchstart )イベントの例です。
タッチデバイスでの操作がキャンセルされると発生するイベントです。この例では、どのタイミングで touchcancel、touchstart、touchend、touchmove の各イベントが発生するかを確かめるためにタッチデバイスに関するイベントを網羅しています。
タッチデバイスに関連するイベント
タッチイベントには下記のイベントがあります。
| touchstart | タッチデバイスでエレメントに触れる |
| touchend | エレメントから指が離れる |
| touchmove | 画面上で指を動かす |
| touchcancel | タッチイベントが中断する |
