Remove delay of Superfish dropdown menu onmouseover, while keeping the Hoverintent delay onmouseout

chocolata picture chocolata · Nov 22, 2011 · Viewed 9.4k times · Source

I'm having trouble removing the initial delay of the Superfish dropdown fix. My client wants a delay onmouseout, but not a delay onmouseover.

I've got a pure CSS dropdown menu (identical to the Twentyten dropdown menu) and am applying Suckerfish.js to this.

Here is my code:

$('ul#menu-airco-mb-navigatiestructuur').superfish({
    delay: 600,
    autoArrows:    false,
    speed: 'fast'
}); 

I've been reading through the manual of Superfish, but I can't seem to find what triggers the initial delay. Maybe it has something to do with the animation animation: {opacity:'show'} (which I cannot seem to get my head around).

Assistance is appreciated!

Answer

joel_birch picture joel_birch · Dec 14, 2011

It seems like you might be including the HoverIntent plugin. One of Superfish's options is "disableHI". If you set that to "true" then Superfish will not use HoverIntent to delay the mouseenter event. Or you could just not include the HoverIntent plugin if you do not plan on using it elsewhere on the site. Hope this helps.

$('ul#menu-airco-mb-navigatiestructuur').superfish({
    delay: 600,
    autoArrows: false,
    speed: 'fast',
    disableHI: true
});

I have created two test cases. The first one is a simplified version of your page using your CSS and the second is exactly the same except I removed all your CSS and only included the basic superfish.css found on the Superfish website. I also altered the menu class from 'menu' to 'sf-menu' just so the superfish.css works.

Notice that the version with my CSS works like you want it to, whereas the the one with your CSS has the bug you describe. I guess there is a CSS issue that you could sort out by comparing mine to yours and altering yours to match it closer. One difference I see is that I set the sub menu ULs to a fixed em width and their child LIs to 100%, whereas you do not. This isn't the culprit, but shows that you may benefit from aligning your CSS more closely with the tried and tested way of doing Superfish menus. Hope this helps.