嗨我已經使用了一個我在網上找到的教程,以幫助我製作一個褪色圖像 當用戶懸停在它上面..我試圖把標題放在這個 圖像,但現在遇到了一個問題,意味着當用戶將鼠標懸停在 在它上面的標題,圖像淡出再次..我真的想要得到它 做的是整個事情淡入上懸停顏色..翻轉效果
這是JSFiddle http://jsfiddle.net/xxfairydragonxx/RpcRe/
如果有人能夠看到這樣做的方式,我將如此偉大!
這裏是我的代碼:
HTML
<div id="part2">
<div class="fadehover">
<div class="center">
<h4>Independant Living</h4>
</div><a href="#"><img alt="" class="a" src=
"http://coffeemachines4u.co.uk/HarmonyHomes/Images/IndependantLiving.jpg"></a>
<img alt="Harmony Homes Transitions" class="b" src=
"http://coffeemachines4u.co.uk/HarmonyHomes/Images/IndependantLivingColor.jpg"></div>
</div>
jQuery的
$(document).ready(function() {
$("img.a").hover(
function() {
$(this).stop().animate({
"opacity": "0"
}, "slow");
},
function() {
$(this).stop().animate({
"opacity": "1"
}, "slow");
});
});
最好的辦法是將標題到錨所以當你將鼠標懸停在該圖像淡入,或者您可以將懸停功能移至淡化類 – Huangism