JS can u explain this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

JS can u explain this code

I just found this code, and I thought it was awosome. I kinda understood everything but didn't understand what - var e (window.event), - var x ClientX, - var yClientY, mean. Can u explain this three things? https://code.sololearn.com/W3WnF9OHfG6K/?ref=app

27th Jul 2019, 5:32 AM
Ginfio
Ginfio - avatar
2 Answers
+ 1
window.event is deprecated, but used to return the current event, that's handled inside the event listener. Instead you should use the first argument of the event listener to receive the properties of the event. clientX and clinetY are properties of any mouse event and return the coordinates of the mouse. By setting the style according to the mouse pointer, the CSS animation starts and smoothly moves the circles in place. Btw. I cleaned up the code a bit because it was really messed up and certainly not a good example for clean and readable JS: https://code.sololearn.com/WXzspntX8Gzx/?ref=app
27th Jul 2019, 6:52 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Aaron Eberhardt ok, thanks
27th Jul 2019, 6:54 AM
Ginfio
Ginfio - avatar