JSFiddle - React, Tailwind, and code Playground

by j_u_l_e_e

HTML

<!DOCTYPE html>
<html>
<body>

<h1>Long tap demo</h1>
<div id="div1">
</body>
</html>

CSS

#div1 {
  background: url(https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Cat_poster_1.jpg/1920px-Cat_poster_1.jpg);
  background-size:     cover;
  width: 400px;
  height: 250px;
}

JavaScript

function absorbEvent(event) {
  event.returnValue = false;
}

let div1 = document.querySelector("#div1");
div1.addEventListener("touchstart", absorbEvent);
div1.addEventListener("touchend", absorbEvent);
div1.addEventListener("touchmove", absorbEvent);
div1.addEventListener("touchcancel", absorbEvent);