Jump to content

canvas element


birbal
 Share

Recommended Posts

How can i determine the position cordinate on a mouseclick in a canvas element (relative to the canvas element)?any help will be appriciated.

Edited by birbal
Link to comment
Share on other sites

You could subtract the coordinates of the canvas element from the event.pageX & event.pageY properties. canvas.style.left and canvas.style.top won't work, however, if the element is being pushed around by previous elements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...