【发布时间】:2010-08-19 10:29:05
【问题描述】:
我希望实现以下目标:
- 连续显示 5 张图片
- 单击图像以显示与该图像相关的内容
- 点击另一张图片显示相关内容,并隐藏之前的内容
这是我对图像的标记:
<div id="maps">
<div class="map-box"><h2>London & South East</h2><a href="#"><img src="/img/map_london.jpg" /></a></div>
<div class="map-box"><h2>South West, Ireland and Wales</h2> <a href="#"><img src="/img/map_south_west.jpg" /></a> </div>
<div class="map-box"><h2>South Central & Home Counties</h2> <a href="#"><img src="/img/map_south_central.jpg" /></a> </div>
<div class="map-box"><h2>North England, Northern Ireland & Scotland</h2> <a href="#"><img src="/img/map_north.jpg" /></a> </div>
<div class="map-box"><h2>Midlands</h2> <a href="#"><img src="/img/map_midlands.jpg" /></a> </div>
</div>
当用户点击图片时,我想直接在其下方显示 DIV 的内容。像这样:
<div id="london">
<p>content london</p>
</div>
<div id="south-west">
<p>content south west</p>
</div>
<div id="south-central">
<p>content south central</p>
</div>
<div id="north">
<p>content north</p>
</div>
<div id="midlands">
<p>content midlands</p>
</div>
这显然可以通过 jQuery 显示/隐藏来实现,但是从我在 Stack Overflow 上查看的所有示例中,我无法找到正确的组合。
非常感谢任何提示,谢谢。
【问题讨论】: