0

I have a html <img id="button"> which calls functions with onmousedown="down();" and onmouseup="up();". Holding the button down activates an interval loop, so it's about holding the button pressed and clearing the interval when mouse comes up.

Now this is working fine and has great compatibility with old browsers, but holding the button pressed does not work with smartphones (at least not android). Tutorials recommend using pointer events instead, but then I would lose the compatibility with old browsers.

So I'm asking, if I would use

<img id="button" onmousedown="down();" onmouseup="up();" ontouchstart="down();" ontouchend="up();">

would there be problems if I just add touchstart and touchend attributes to the img tag? Or will the touch events disrupt the onmousedown and onmouseup events?

0 Answers0