Вопрос

I have built an image map of Ireland which will list suppliers by county, but I want each county to display only when it's clicked on. I tried to use the jQuery suggested in this question

$('[item]').click(function(){
var item=$(this).attr('item');
$(".display").hide();
$("#"+item).show();
return false;
});

but it's not working with the first two counties on my map e.g.

<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>

With this CSS as a test:

.display {
background-color: red;
color: white;
padding: 5px;
text-align:center;
display:none;
}

What am I doing wrong that this is not working the same way as the original fiddle?

My fiddle.

Это было полезно?

Решение

Because you didn't include jQuery library! See UPDATED DEMO HERE

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top