我有以下的html:Jquery的哈弗,當我離開鼠標移到元素的行爲怪異
<div id="join-us-subheader-imgs">
<div class="subheader-img-wrapper">
<img src="/wp-content/themes/lib/join_us/join-us_1.png">
<p class="img-quote">"This is a quote example. And there's more text here."</p>
</div>
<div class="subheader-img-wrapper">
<img src="/wp-content/themes/lib/join_us/join-us_2.png">
<p class="img-quote">"This is a quote example. And there's more text here."</p>
</div>
</div>
和CSS:
.subheader-img-wrapper {
float: left;
margin-right: 10px;
position: relative;
}
.subheader-img-wrapper img:hover{
cursor: pointer;
}
.img-quote {
display: none;
width: 125px;
height: 80px;
position: absolute;
top: 0;
}
AAAND的JavaScript:
$(document).ready(function() {
$(".subheader-img-wrapper").hover(
function(){
$(this).find('img:first').fadeOut("slow", function(){
$(this).parent().find('p:first').fadeIn("slow");
});
},
function(){
$(this).find('p:first').fadeOut("slow", function() {
$(this).parent().find('img:first').fadeIn("slow");
});
}
);
});
的東西是,當我把鼠標放在第一個上面時,它開始進出懸停功能,就像我
你提供的jsfiddle – Jay 2012-03-12 20:56:30