jQuery fade flickers

后端 未结 2 596
我寻月下人不归
我寻月下人不归 2020-12-19 13:49

I have jQuery fade going here: http://dougie.thewestharbour.com/

When you hover over the .main-overlay div I would like it to fade out then when you take your mouse

2条回答
  •  醉话见心
    2020-12-19 14:23

    It's happening because fadeOut has a display:none at the end of it, so when you move your mouse after the fadeOut has completed it will trigger the unhover function. Instead, just animate the opacity:

    $('.main-overlay').hover(function() {
        $(this).animate({opacity: 0}, 1000);
    }, function() {
        $(this).animate({opacity: 1}, 1000);
    })
    

    Example →

提交回复
热议问题