jquerymouseoverdelayhoverintent

Delay with hoverintent


var config = {    
     sensitivity: 3,    
     interval: 5000,     
     timeout: 5000,    
};

$("#cart-summary").hoverIntent(function () {
        $('.flycart').slideDown('fast');
}, function() {
        $('.flycart').slideUp('fast');
}).find('a.close').click(function(){
   $(this).parents('.flycart').hide();
});

...this works, but two issues:

  1. It doesn't seem to wait 5 seconds like it should, opens almost instantly no matter what I Set.

  2. Affects all elements using the hoverintent plugin on the same page.

I'd really appreciate any help. Thanks!


Solution

  • You're not passing the config object to hoverIntent, so it's using defaults: http://cherne.net/brian/resources/jquery.hoverIntent.html

    To clarify,

    var config = {
         sensitivity: 3,
         interval: 5000,
         timeout: 5000
    };
    
    $("#cart-summary").hoverIntent(function () {
        $('.flycart').slideDown('fast');
    }, function() {
        $('.flycart').slideUp('fast');
    }).find('a.close').click(function () {
        $(this).parents('.flycart').hide();
    }, config);