我这里有一个jQuery淡入淡出效果:http://dougie.thewestharbour.com/
当你将鼠标悬停在 .main-overlay div 上时,我希望它淡出,然后当你将鼠标移开时,我希望它淡入。
但是,你可以看到它现在只是闪烁。我猜测这是因为div消失了,所以当它淡出时被视为mouseout,但我不知道如何解决它。
这是我的javascript代码:
感谢您的来信,
Wade
但是,你可以看到它现在只是闪烁。我猜测这是因为div消失了,所以当它淡出时被视为mouseout,但我不知道如何解决它。
这是我的javascript代码:
$(document).ready(function () {
$('.main-overlay').hover(
//Mouseover, fadeIn the hidden hover class
function() {
$(this).fadeOut('1000');
},
//Mouseout, fadeOut the hover class
function() {
$(this).fadeIn('1000');
}).click (function () {
//Add selected class if user clicked on it
$(this).addClass('selected');
});
});
以下是其中一个覆盖层div所附加的项目:
<li><div class="main-overlay"></div><span class="caption">The store front</span><img src="http://dougie.thewestharbour.com/wp-content/uploads/store-front.jpg" alt="store front" title="store-front" width="730" height="360" class="alignnone size-full wp-image-98" /></li>
感谢您的来信,
Wade