I'm writing an HTML5 app based on canvas with mouse and touch support. For mouse event I'm using this function:
canvas.onmousedown = function (e) { .... }
And this for touch events:
canvas.ontouchstart = function (e) { .... }
Click events are working fine, but when on touch input both events are fired.
Is there a way to prevent firing the click event on touch input?
Try registering
onmousedown
event only whentouchstart
event is not available.