• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image position

 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to know the absolute position in pixels for one element (image for example) placed on a web page.

I would like to open a layer where the image is clicked. Now I am doing this using the cursor position but. it depens on where is clicked to recalculate the position of the layer.

Is there any property of the image that tells the position.

Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you were using a library such as jQuery it would be easy to do, if you are just writing JavaScript yourself, the basic idea is:



Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic