+ 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
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
+ 1
Aaron Eberhardt ok, thanks