Cursor tracking problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Cursor tracking problem

How can i get the coordinates of the cursor relative to a divider? I've tried using clientX and clientY but i dont understand how to access them.

29th Jul 2022, 11:59 AM
Pablo González
Pablo González - avatar
2 Answers
+ 2
https://code.sololearn.com/W7h17CZuUANB/?ref=app I have used clientX and clientY in a project of mine. Maybe this will help. So basically, you make a function with a parameter(evt for example). inside the function you make a variable, let s say: let abc= evt.clientX; You add that function in a event for any html element(body, for example)(can be seen in the code) whenever the event listener is triggered, your variable will tell you what is the cursor position. For this code I used click event, but it works with any event.
29th Jul 2022, 12:32 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
0
Now i understand what was the problem, thank you. Nice app by the way.
29th Jul 2022, 1:21 PM
Pablo González
Pablo González - avatar