I’m trying to make an object to move in an area when clicking the area with the left pointer.
- Is this possible in javascript/jquery?
- Can you please give me some examples if possible?
- I’m aiming to do this in javascript/html/css
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do it like this (Working Demo in jsFiddle):
Whenever the click event happens, it’s
pageXandpageYvalues are taken using which the exact location of the click in the canvas object is found. This coords are then used in jQuery animate function to change the location of the object div in it.