gpt4 book ai didi

javascript - 具有显示/隐藏 div 功能的可点击图像映射

转载 作者:太空宇宙 更新时间:2023-11-04 13:34:47 25 4
gpt4 key购买 nike

我已经构建了爱尔兰的图像 map ,它将按县列出 vendor ,但我希望每个县仅在单击时显示。我尝试使用建议的 jQuery in this question

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

但它不适用于我 map 上的前两个县,例如

<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 的工作方式不同?

My fiddle.

最佳答案

因为您没有包含 jQuery 库!参见 UPDATED DEMO HERE

关于javascript - 具有显示/隐藏 div 功能的可点击图像映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23112998/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com