someElement.addEventListener("touchstart", (e) => {
// Invoke the appropriate handler depending on the
// number of touch points.
switch (e.touches.length) {
case 1:
handle_one_touch(e);
break;
case 2:
handle_two_touches(e);
break;
case 3:
handle_three_touches(e);
break;
default:
console.log("Not supported");
break;
}
});TouchEvent: touches property / notebook
TouchEvent: touches property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.