Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DHTML Images relative positions

Posted on 2000-04-03
2
Medium Priority
?
213 Views
Last Modified: 2010-04-09
I have a page that contains a map image.

On top of this map image I wish to float another graphicor multiple graphics to show the position of an event. I can happily place one image on top of the other but I cannot gurantee the position of the map on the page so I need to position the floating graphic relative to the position of the map.

So..
How do I find the current position of the map?
How can I then use this to position the image(s) relative to the map?
0
Comment
Question by:bigprop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
brigmar earned 600 total points
ID: 2681235
Andrew,

You need to put all the images inside a container, and make the positions relative to that container.
The container should be the same size (in pixels) as the map.

<html>
 <body>
 blah BEFORE blah
 <div id="container" style="position:relative; height:400; width:200;">
  <div id="map" style="position:absolute; left:0; top:0;"><img src="map.gif" height="400" width="200"></div>
  <div id="img1" style="position:absolute; left:15; top:15;"><img src="beacon.gif" width="10" height="10"></div>
  <div id="img2" style="position:absolute; left:55; top:55;"><img src="beacon.gif" width="10" height="10"></div>
  <div id="img3" style="position:absolute; left:55; top:15;"><img src="beacon.gif" width="10" height="10"></div>
  <div id="img4" style="position:absolute; left:15; top:55;"><img src="beacon.gif" width="10" height="10"></div>
 </div>
 blah AFTER blah
 </body>
</html>

You can also specify the z-index, but this is unnecessary in this case, as the browser will put elements defined earlier behind the elements defined later.

Good Luck,

Brian
0
 

Author Comment

by:bigprop
ID: 2683960
Thanks Brian

It works a treat. In fact I found that I didn't have to put the images into their own divs merely have them in the container div.

Keep in touch

Andrew
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question