[Solved] Help!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 27

[Solved] Help!!!

Hover effect working on computer, but in phone no, I want make draw app, but hover effect doesn't working. Can someone help me? Thanks https://code.sololearn.com/Wb4E49UBURp1/?ref=app

18th Feb 2021, 3:19 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
24 Answers
+ 16
use touchstart,touchmove,touchend-events for getting coordinates x=e.touches[0].clientX; y=e.touches[0].clientY; https://code.sololearn.com/W8jwJqyt4K2y/?ref=app
18th Feb 2021, 4:57 PM
SAN
SAN - avatar
+ 8
visph Thank you so much😁
18th Feb 2021, 3:44 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 5
Sofi hover effect uses pointer to just add effects not to draw so you can use js as others said I know I am late 📑so I dont know what you did in the code please forgive if I gave wrong information🤔🤔🤔
19th Feb 2021, 1:12 PM
Queen👽
Queen👽 - avatar
+ 4
I will do second too Harsh [Studies 📚]
18th Feb 2021, 5:04 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 4
Harsh [Studies 📚] for both devices Use touchstart touchmove touchend mousedown mousemove mouseup
18th Feb 2021, 5:09 PM
SAN
SAN - avatar
+ 3
you should use touch/pointer events in addition to mouse events to fully handle touch devices (touch is default mapped to click, and some other are defined, but complete implementation should be yours ;))
18th Feb 2021, 3:27 PM
visph
visph - avatar
+ 3
Yes I'm original author, btw ok thanks😁
18th Feb 2021, 3:32 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 3
https://christianliebel.com/2015/05/enabling-cross-platform-touch-interactions-pointer-vs-touch-events/ at least to see the touch/pointer similarities (and browsers support -- may not reflect actual support)
18th Feb 2021, 3:42 PM
visph
visph - avatar
+ 3
You have used only mouse events they are not supported in touch devices so use touch events also :)
18th Feb 2021, 4:29 PM
Harsh
Harsh - avatar
+ 3
Thank you Muskan 😁
19th Feb 2021, 3:52 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 3
19th Feb 2021, 3:53 PM
Queen👽
Queen👽 - avatar
+ 2
visph but where I must write it and how?
18th Feb 2021, 3:28 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 2
are you the original author of this code? if so, you need to write it as you write your mouse events handler, with some asjustements (touch events could hold multi-points, while mouse hold only one point)
18th Feb 2021, 3:31 PM
visph
visph - avatar
+ 2
visph I mean I must write same with touch(e.touch.clientX)?
18th Feb 2021, 3:34 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 2
18th Feb 2021, 4:39 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 2
Wow Thank you so much ŚĄŃ 😄
18th Feb 2021, 4:59 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 2
Sofi welcome
18th Feb 2021, 5:03 PM
SAN
SAN - avatar
+ 2
ŚĄŃ but it will work only in touch devices
18th Feb 2021, 5:04 PM
Harsh
Harsh - avatar
+ 2
Ok Sofi
18th Feb 2021, 5:05 PM
Harsh
Harsh - avatar