This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Image position Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Image position" Watch "Image position" New topic
Author

Image position

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 93

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

Joined: Nov 08, 2001
Posts: 15361
    
    6
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Image position
 
Similar Threads
Image Click Event
Move enlarged image around on mouseover - Image mapping
How can i use mouse to click on an image and draw a point after i clicked ?
Showing loading while disabling the background
Textbook on image