我已经建立了爱尔兰的图像地图,它将按县列出供应商,但我希望每个县只有在点击时才会显示。我尝试使用jQuery建议的in this question
$('[item]').click(function(){
var item=$(this).attr('item');
$(".display").hide();
$("#"+item).show();
return false;
});
但它没有在我的地图上的前两个县工作,例如
<IMG SRC="http://i61.tinypic.com/25su2q9.gif" USEMAP="#irelandmap" BORDER=0>
<MAP NAME="irelandmap">
<AREA SHAPE=POLY COORDS="148,103,165,94,170,94,179,87,170,80,169,74,173,74,179,73,188,67,192,60,195,51,195,44,201,38,210,30,221,21,218,18,213,13,208,8,208,14,206,17,202,17,196,17,190,17,197,33,197,34,191,46,185,52,179,49,183,40,187,29,183,23,180,39,176,36,175,30,174,25,172,33,167,32,166,28,162,25,153,32,146,30,144,37,138,46,138,53,141,60,144,62,140,63,131,64,137,70,133,74,121,72,118,81,127,85,134,86,140,85,146,81,156,81,160,85,157,91,148,93,147,101" href="#" alt="donegal" item="donegal" OnMouseOut="window.status=''; return true" TITLE="Donegal">
<AREA SHAPE=POLY COORDS="197,52,197,43,200,38,205,35,211,37,219,37,224,30,224,24,232,24,240,23,244,26,256,73,251,79,244,81,233,73,227,69,228,61,218,60,199,47" href="#" alt="Derry" item="derry" OnMouseOut="window.status=''; return true" TITLE="Derry">
...
<strong>ULSTER</strong>
<div id="derry" class="display">Derry
Test</div>
将此CSS作为测试:
.display {
background-color: red;
color: white;
padding: 5px;
text-align:center;
display:none;
}
我做错了,这与original fiddle的工作方式不同?