首页 > 代码库 > map area (append)
map area (append)
<html>
<body>
<script src=http://www.mamicode.com/"http://code.jquery.com/jquery-1.11.0.min.js"></script>
<!--<script src=http://www.mamicode.com/"http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>-->
<script >
$(function(){
$("map area").hover(function(){
$("#content").empty().append(this.alt).show();;
},function(){
$("#content").hide();
})
})
</script>
<img
src=http://www.mamicode.com/"eg_planets.jpg"
border="0" usemap="#planetmap"
alt="Planets" />
<map name="planetmap" id="planetmap">
<area
shape="circle"
coords="180,139,14"
href =http://www.mamicode.com/"/example/html/venus.html"
target ="_blank"
alt="Venus" />
<area
shape="circle"
coords="129,161,10"
href =http://www.mamicode.com/"/example/html/mercur.html"
target ="_blank"
alt="Mercury" />
<area
shape="rect"
coords="0,0,110,260"
href =http://www.mamicode.com/"/example/html/sun.html"
target ="_blank"
alt="Sun" />
</map>
<div id="content" style="position: absolute;top: 50%;left: 50%;display: none;width: 200px;height: 20px;background-color: red;">
</div>
</body>
</html>
map area (append)