delay() or timeout with stop()?

前端 未结 4 547
生来不讨喜
生来不讨喜 2020-12-14 17:47
$(\'.file a\').live(\'mouseenter\', function() {
    $(\'#download\').stop(true, true).fadeIn(\'fast\');
}).live(\'mouseleave\', function() {
    $(\'#download\').st         


        
4条回答
  •  醉梦人生
    2020-12-14 18:36

    Use a setTimeout function

    $('.file a').live('mouseenter', function() {
    setTimeout(function(){
        $('#download').stop(true, true).fadeIn('fast');
    }, 1000);
    }).live('mouseleave', function() {
        $('#download').stop(true, true).fadeOut('fast');
    });
    

    setTimeout will execute the code inside the function after the specified miliseconds (in this case 1000).

提交回复
热议问题