我有jQuery fade在这里:
http://dougie.thewestharbour.com/
当你将鼠标悬停在.main-overlay div上时,我希望它会淡出然后当你将鼠标从它上面移开时,我希望它能够淡入.
但是,你可以看到它现在只是闪烁.我猜这是因为div消失所以当它消失时它被视为鼠标输出,但我不知道如何去解决它.
这是我的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>
谢谢,
涉