JSFiddle - React, Tailwind, and code Playground

by uedatakuya

HTML

<div id="hoge">ほげ</div>
<div id="piyo">ぴよ</div>

CSS

div {
    width: 100px;
    height: 50px;
    color: white;
    text-align:center;
    margin: 10px 10px 10px 10px;
    background-color: #666;
}

JavaScript

document.getElementById('hoge').addEventListener('touchend', function () {
    alert("hoge");
    ev.preventDefault();
    ev.stopPropagation();

}, false);

document.getElementById('piyo').addEventListener('touchend', function () {
    alert("piyo");
    ev.preventDefault();
    ev.stopPropagation();

}, false);

document.body.addEventListener('touchend', function (ev) {
    if (ev.changedTouches.length > 1) {
        ev.stopPropagation();
    }
    ev.preventDefault();
}, false);