我有一些 javascript 的问题。我想在悬停图像时显示一个 div:
<div class="slideshow">
<img src="img/picture1.jpg" id="picture1" />
<img src="img/picture2.jpg" id="picture2" />
</div>
<div class="pic1desc">
<h3>Headline</h3><br />
Text
</div>
<div class="pic2desc">
<h3>Headline</h3><br />
Text
</div>
这是我的 javascript 片段:
$(document).ready(function() {
$('.pic1desc').hide();
$('.pic2desc').hide();
//When the Image is hovered upon, show the hidden div using Mouseover
$('#picture1').mouseover(function() {
$('.pic1desc').show();
});
//When the Image is hovered away from, hide the div using Mouseout
$('#picture1').mouseout(function() {
$('.pic1desc').hide();
});
});
这根本行不通。有人对此有想法吗?提前致谢!