How to implement a onmousedown and onmouseup on a touch screen iphone

前端 未结 2 674
悲&欢浪女
悲&欢浪女 2020-12-03 17:07

I\'ve very new to HTML/Java but am learning...

I want to develop a button on an iphone that runs a java script command when press and when it is released. I\'ve don

相关标签:
2条回答
  • 2020-12-03 17:20

    You might be interested in onpointerup and onpointerdown events which will work on both touch and non touch devices. Check browser support

    0 讨论(0)
  • 2020-12-03 17:43

    The equivalent for onmousedown on touchscreen devices is ontouchstart, and the equivalent of onmouseup is ontouchend.

    If you would also like to detect dragging, you could use ontouchmove which is fired every time you move your finger after touching the screen.

    0 讨论(0)
提交回复
热议问题