7
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!

eozzy
  • 66,048
  • 104
  • 272
  • 428

2 Answers2

8

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);
basher
  • 2,381
  • 1
  • 23
  • 34
lod3n
  • 2,893
  • 15
  • 16
2

This might be more clearer

function liMouseOverTrigger() {
    $(this).addClass('hover');
}

function liMouseOutTrigger() {
    $(this).removeClass('hover');
}

function tabHoverDelay() {

        var config = {
            sensitivity: 1,
            interval: 100,
            timeout: 400,
            over: liMouseOverTrigger,
            out: liMouseOutTrigger
        },
            config2 = {
                sensitivity: 1,
                interval: 350,
                timeout: 600,
                over: liMouseOverTrigger,
                out: liMouseOutTrigger
            };


        $('.js-navTabHover li').each(function () {
            $(this).hoverIntent(config);
        });

        $('.js-navTabHoverContent li').each(function () {
            $(this).hoverIntent(config2);
        });

    }

$(document).ready(function () {
    tabHoverDelay();
});
Dally S
  • 619
  • 9
  • 11