Tricky delay on mouseover

前端 未结 5 2255
借酒劲吻你
借酒劲吻你 2021-02-14 14:10

This is what I have currently:

$(\"#cart-summary\").mouseenter(function () {
    $(\'.flycart\').delay(500).slideDown(\'fast\');
});
$(\".flycart\").mouseleave(f         


        
5条回答
  •  攒了一身酷
    2021-02-14 15:04

    You can use the hoverIntent plugin as follows:

    var config = {    
         sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
         interval: 500, // number = milliseconds for onMouseOver polling interval    
         timeout: 500, // number = milliseconds delay before onMouseOut    
    };
    
    $(".flycart").hoverIntent(function () {
            $('.flycart').slideDown('fast');
    }, function() {
            $('.flycart').slideUp('fast');
    }).find('a.close').click(function(){
       $(this).parents('.flycart').hide();
    });
    

提交回复
热议问题