+ 7
How to make something happen when you hold your finger on a button?
I searched on google, and I found out I have to use mousedown and mouseup events. I was thinking to add the function inside an interval on mousedown and clearing the interval at mouseup. But I failed. I need some help. An example would help a lot. Thx.
4 Answers
+ 2
You should use touchstart and touchend events
https://code.sololearn.com/WIw0Ffq5vvQH/?ref=app
+ 3
I think I did something similar to that but then, I needed to add a click event, and everything started acting weird.
+ 2
so the solution is using ontouchstart html element and set interval using JS.
+ 1
Click event would not fired, if you hold the button in longer period.