How To Get The Coordinates Clicked On An HTML5 Canvas?
I need to get the x and y coordinates of where I clicked on an HTML5 canvas element. I did the following for the y coordinate: $('#my_canvas').click(function(event) { ale
Solution 1:
Use pageY instead of clientY
, so that both the coordinates you compare are relative to the document :
event.pageY-$(this).offset().top
Post a Comment for "How To Get The Coordinates Clicked On An HTML5 Canvas?"