Skip to content

Instantly share code, notes, and snippets.

@jflatow
Last active August 29, 2015 14:00
Show Gist options
  • Save jflatow/11327979 to your computer and use it in GitHub Desktop.
Save jflatow/11327979 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Disappearing touch events</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
<g id="g">
<rect id="rect" x="10" y="10" width="10" height="10" fill="rgba(255, 0, 0, .5)" />
<circle id="circle" cx="15" cy="15" r="5" fill="rgba(0, 0, 0, .5)" />
</g>
</svg>
<script>
g.ontouchstart = g.ontouchmove = g.ontouchend = g.ontouchcancel = function (e) {
console.log(e)
}
var T;
circle.ontouchmove = function () {
if (!T)
T = setTimeout(function () { g.removeChild(circle)})
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment