當我懸停一個元素,然後懸停一個內部元素時,我遇到了麻煩。我不知道它是否是我想要實現的最佳方式。這裏是我的代碼:jQuery防止懸停兒童閃爍
我的標記:
<div class="wrapper">
<div class="animation">
<a href="#" class="linked"><img src="#"/></a>
<h1 class="title hidden"><a href="#">blabla</a></h1>
</div>
</div>
我的JS:
$('.animation a img').hover(function(){
$(this).parent().next().stop().fadeTo("medium", 1);
$(this).stop().fadeTo("fast", 0);
}, function(){
$(this).parent().next().stop().fadeTo("medium", 0);
$(this).stop().fadeTo("fast", 1);
});
CSS:
#wrapper {margin: 0 auto; width: 960px;}
#hidden {display: none;}
h1 a {bottom: 0; float: left; font-size: 1.5em; left: 0; position: absolute; width: 460px;}
.linked {background: #666; float: left; height: 250px;}
當我將鼠標懸停在H1的閃爍開始。有什麼辦法可以禁用或修復它嗎?
提前致謝!
哪裏CSS? – s84 2011-03-14 05:41:14
我沒有看到任何閃爍 – 2011-03-14 05:48:26
當你把H1懸停似乎有另一個動畫,它是從父母img輕彈不透明,我想停止 – 2011-03-14 05:50:44