Passionate full stack web developer, course author for Educative, book author for Packt, he/him.
Find my work and get to know me on my Linktree: https://linktr.ee/thormeier
That's a bit tricky, actually! touchstart and touchend can be used to replace the click, mousedown and mouseup events on mobile, but there's no equivalent of mouseover for touch events. But I could try touchemove, that might work. Got any other idea how to solve this?
I guess touchmove is the only option you got here. Since you already have x,y,width and height on your strings you can map the x and y of your touchmove event to the appropriate area. The simplest approach would be to select all areas and filter
Passionate full stack web developer, course author for Educative, book author for Packt, he/him.
Find my work and get to know me on my Linktree: https://linktr.ee/thormeier
This could also be used to replace all the click handlers on all the rects and improve performance a bit on slower devices, too! I'll definitely do that in the second version of this.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That's a bit tricky, actually!
touchstart
andtouchend
can be used to replace theclick
,mousedown
andmouseup
events on mobile, but there's no equivalent ofmouseover
for touch events. But I could trytouchemove
, that might work. Got any other idea how to solve this?I guess
touchmove
is the only option you got here. Since you already havex
,y
,width
andheight
on your strings you can map thex
andy
of your touchmove event to the appropriate area. The simplest approach would be to select all areas and filter(maybe double check that y condition if y is not 0 on the top left ;), also maybe double check the borders and substitute
<=
with<
or>=
with>
)This could also be used to replace all the click handlers on all the rects and improve performance a bit on slower devices, too! I'll definitely do that in the second version of this.