我有一些javascript的问题。我想徘徊的图像时显示一个div:jQuery show()隐藏()鼠标在图像上
<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();
});
});
这是不工作的。有人有这个想法吗?提前致谢!
包括jQuery的? – MrCode
这是工作正常见控制台错误,如果这不起作用,可能会有其他错误 – Raghurocks
可能你忘了包括jQuery脚本? –