tags:

views:

15

answers:

1

Is there a way for me to get the absolute position of a DIV element within a HTML5 Canvas element? Any help is greatly appreciated.

+1  A: 

noVNC (HTML5 VNC client) has some routines that can determine:

  • the actual position of a DOM element on a page: getPosition
  • the offset within that DOM element where a mouse click happened: getEventPosition

They should be fairly cross-browser.

You can use those as reference and that might help with your issue: http://github.com/kanaka/noVNC/blob/master/include/util.js#L121

Disclaimer: I made noVNC.

kanaka
+1 noVNC is awesome. Thanks for sharing your hard work. keep on rocking.
Ninja Dude