javascriptjqueryhtmljquery-hoverhoverintent

Set interval on jQuery hoverIntent


I am using the jQuery hoverIntent plugin and I love it. However, I am having trouble setting a custom interval. My jQuery is:

   var hoverSetting = {
                            sensitivity: 4,
                            interval: 75,
                        };

                        navItem.hoverIntent(function(hoverSetting) {
                            if (searchIsVisible == false) {
                                overlay.delay( 500 ).css('display', 'block');
                                $(this).find('ul').toggleClass("active");
                                overlayIsVisible = true;
                            }
                        });

How can I make the interval at which hoverIntent works custom (I would like to slow it down)


Solution

  • Use this syntax instead:

    var handleInOut = function(){
               if (searchIsVisible == false) {
                    overlay.delay( 500 ).css('display', 'block');
                    $(this).find('ul').toggleClass("active");
                    overlayIsVisible = true;
                }       
           };
    
    navItem.hoverIntent({
       over: handleInOut,
        out: handleInOut,
        sensitivity: 4,
        interval: 750
    });