Imagine one of the divs is mouse and the other one is cat, I want the cat to follow the mouse and if the cat reaches the mouse, they stop moving and print a message on screen.

I would appreciate if you could help me to find the solution.

I tried to move the mouse randomly, but I can't find the perfect solution yet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.