我想创建一些jquery样式的悬停淡入/淡出缩略图。我已经设法在图像上进行悬停,但是这是一个问题。当用户悬停时,我想要一些文字出现,这是我用CSS实现的,问题在于,当用户将文字悬停在文字上时,图像逐渐淡入。我想知道如何才能让它继续呈现图像保持淡出状态,同时也徘徊在文本上。我不希望文字变淡,我只是尝试在脚本部分切换到拇指类。jquery悬停淡出缩略图
<script>
$(document).ready(function(){
$(".thumb img").fadeTo("fast", 1.0); // This sets the opacity of the thumbs to fade down to 60% when the page loads
$(".thumb img").hover(function(){
$(this).fadeTo("fast", 0.3); // This should set the opacity to 100% on hover
},function(){
$(this).fadeTo("fast", 1.0); // This should set the opacity back to 60% on mouseout
});
});
</script>
HTML
<div class="thumb">
<a href="#"><img src="images/hooty_thumb.png" width="250" height="224"/></a>
<div class="title">
<h1 class="din"><a href="#">TITLE HERE</a></h1>
<h2><a href="#">Branding, Print, Web</a></h2>
<h2><a href="#">2011</a></h2></div></div>
CSS:
.thumb {float: left; background-color: #FFF; z-index: 1; width: 250px; height: 225px; margin-right: 27px; margin-bottom: 45px; display: inline-block; *display:inline; *zoom: 1; position: relative;}
.thumb .title{position:absolute; width: 250px; top: 40%; left:0%; text-align: center; display: none; z-index: -1;}
.thumb:hover .title{display: inline; z-index: 1;}
.thumb .title h1{color:#00F;}
谢谢谢谢你谢谢! – Amy