Solved

DHTML Images relative positions

Posted on 2000-04-03
2
199 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 200 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 68
Do alert on select 6 26
HTML auto refresh to another site 4 28
html form layout 4 36
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

756 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