Delay with hoverintent

eozzy picture eozzy · Oct 2, 2009 · Viewed 9.1k times · Source
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!

Answer

lod3n picture lod3n · Oct 2, 2009

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);