【发布时间】:2014-06-15 14:25:30
【问题描述】:
当mousOver 在img 上时,我使用jquery 代码来显示和隐藏文本div。 它工作正常,但是当显示 div 时,当鼠标悬停在 div 上时,它会在鼠标悬停时隐藏并再次显示。 我想要做的是在 mouseOver 图像时显示 div,当 mouseOver 在图像内和 div 不隐藏的文本 div 上时,我希望 div 仅在 img 中的 mouseOut 时隐藏。 问题是我猜是因为我的 div 是 position:absolute,但我必须保留这个。
这是我的 jquery :
$(".image_big").hover(function(){
$('.cartouche').show();
},function(){
$('.cartouche').hide();
});
还有我的 CSS :
.cartouche {display:none;position: absolute;
bottom: 0px;
background-color: #00B252;
color: white;
text-transform: uppercase;
text-align: left;padding: 10px}
.image_big_container{width:473px;height:330px;text-align: center;}
#slideshow{margin-top: 20px;position:relative}
#slideshow_big { margin-bottom:10px}
这里是 JSfiddle,可以看到它的实际效果:
http://jsfiddle.net/m7zFb/352/
我的网站上还有很多图片,并且想仅从所选图片中显示文本 div,有没有办法添加 this.children 以仅针对我鼠标悬停的图片?
希望你能理解我的问题,
感谢您的帮助
【问题讨论】:
标签: jquery css hover show-hide