简体   繁体   English

突出显示图像地图上的区域

[英]Highlight areas on an image map

I have used the following site ( http://www.html-map.com/ ) to create an image map for use on my site. 我已经使用以下网站( http://www.html-map.com/ )创建了一个在我的网站上使用的图像地图。 Currently, when the user hovers over a continent they are presented with a link to a specific page however, there is no visual cue to indicate that the continent is a link. 当前,当用户将鼠标悬停在一个大陆上时,他们会看到指向特定页面的链接,但是没有视觉提示来表明该大陆是一个链接。 Ideally, there would be some sort of icon overlayed on top of the continent that would change colour or preferably the continent itself would be highlighted. 理想情况下,大陆上会覆盖某种图标,该图标会改变颜色,或者最好将大陆本身突出显示。

As the latter would require SVG which is not supported in IE8, I have opted for the former although I think I am approaching it in completely the wrong way. 由于后者需要IE8中不支持的SVG,因此我选择了前者,尽管我认为我完全以错误的方式来处理它。

Currently, I am overlaying an icon over the top of the image using absolute positioning but this means that the whole process of mapping my image in the first place has gone to waste as the link would need to be on the icon and not within the image map. 目前,我正在使用绝对定位在图像上方覆盖一个图标,但这意味着映射我的图像的整个过程已经浪费了,因为链接需要位于图标上而不是图像内地图。

My question is, how can i use the mapped areas I have already defined to overlay the icon for each continent whilst preserving the link behaviour. 我的问题是,如何在保留链接行为的同时使用已经定义的地图区域覆盖每个大洲的图标。

I've tried embedding the span within the area tag but this doesn't work at all. 我尝试将span嵌入area标记中,但这根本不起作用。 Any help or alternative approaches would be greatly appreciated. 任何帮助或替代方法将不胜感激。

HTML HTML

<div class="worldMap">
   <img src="http://s30.postimg.org/8bqsljpvl/worldmap.png" alt="" usemap="#map1400147861975">
   <map id="map1400147861975" name="map1400147861975">
     <area shape="rect" coords="109.99999559765627,10.999995597656266,159.46666159765627,34.46666159765627" title="Europe" alt="Europe" href="#Europe" target="_self">
     <area shape="rect" coords="110.99999559765627,40.999995597656266,147.46666159765627,91.46666159765627" title="Africa" alt="Africa" href="#Africa" target="_self">
     <area shape="rect" coords="63,56,96,103" title="South America" alt="South America" href="#SouthAmerica" target="_self">
     <area shape="rect" coords="25,29,73,42" title="North America" alt="North America" href="#NorthAmerica" target="_self">
     <area shape="rect" coords="25.999995597656266,41.999995597656266,83.46666159765627,55.46666159765627" title="Central America" alt="Central America" href="#CentralAmerica" target="_self">
     <area shape="rect" coords="159.99999559765627,10.999995597656266,251.46666159765627,64.46666159765627" title="Asia" alt="Asia" href="#Asia" target="_self">
     <area shape="rect" coords="190.99999559765627,66.99999559765627,245.46666159765627,101.46666159765627" title="Austrilasia" alt="Austrilasia" href="#Austrilasia" target="_self">
   </map>
   <span class="glyphicon glyphicon-briefcase europe"></span>
</div>

CSS CSS

.europe{
  position: absolute;
  left: 125px;
  top: 22px;
  color: blue;
}

worldMap{
  position: relative;
}

I have created a fiddle here: http://jsfiddle.net/jezzipin/z6UnR/2/ 我在这里创建了一个小提琴: http : //jsfiddle.net/jezzipin/z6UnR/2/

In my opinion i would creat 6 new images for every hovered area. 我认为我将为每个悬停区域创建6张新图像。 you have to change just the explicit color of the hovered area. 您只需要更改悬停区域的显式颜色即可。

Then you load with javascript always the right image for the right area. 然后,您始终使用javascript加载正确区域的正确图像。 I had once such a Project, but im still searching. 我曾经有过这样的项目,但我仍在寻找。

give me a while. 给我一点时间。

PS: As an alternativ mapping program, try "Fast Image Map" PS:作为替代映射程序,请尝试“快速图像映射”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM