+ 6
Mousedown event fires on mobile?
So, while making a game, I stumbled upon a bug where a single click would register twice in the game. Was wondering what the issue could be, and after a while I realized that the handelrs for both mousedwon and touchstart where both being fired. This happened only on mobile Was certain it was an issue with my phone, but then I checked it out with chrome dev tools on my laptop and when inspecting as a mobile device, the same thing happened Yeah, this Is a simple issue to take care of I guess But, does this happen though?
19 Antworten
+ 4
Russ Hmm, so it seems to be an Android only thing
Kode Krasher Here we go again...😎👍
+ 4
Russ Yup, seems like an "only Android" issue, smh
Your feedback is very much appreciated! ^_^
+ 3
Mirielle[ Exams ] I believed the same as well, but from the way to code in the game is, It is certain that the touch and mouse events fire on after another...
Are you on android?
If so, could you check the code above and check if they both fire for you as well?
+ 3
Kode Krasher Another useful template from Space Ace himself!
Touchscreen laptops will be at a loss though as they will losse the consistent firing of mousemove, but that's is a little price to pay!
+ 2
Here is an example code so you can try it out for yourself...
https://code.sololearn.com/WmVwAhHHw6PL/?ref=app
+ 2
Just to add to your troubles, onmousedown doesn't trigger anything for me in your example code. Only when I change it to ontouchstart do I get the alert box.
This is on iPhone.
+ 2
Vachila64☕ Now I just get the "touch event" alert.