[Superfish] Separate superfish on one page - need to close all the others when one is opened

[Superfish] Separate superfish on one page - need to close all the others when one is opened

Hello all,

We're using superfish vertical for several separate menus on a page - #sf-menu-1, #sf-menu-2 and so on.

We also use the delay on hover - this was one of the main reasons for choosing superfish.

However, if after hovering sf-menu-1, one wants to see sf-menu-2, they cover each other, because sf-menu-1 is respecting the set delay.

How could I send a hide instruction from sf-menu-2 to sf-menu-1 (and similar for the other menus on that page)? (It's not a z-index issue, because we don't want them to overlap at all.) Joel said somewhere that Superfish is designed so that different instances would be independent from each other, but that it should still be possible to do this. However, his (untested) suggestion didn't work for me.

I currently have:
  1. $(document).ready(function() {
            $('#sf-menu-1').superfish({
                    delay: 1500, // delay on mouseout in ms
                    speed: 1,
                    autoArrows: false,
                    dropShadows: false,
                    onBeforeShow: function(){
                            if (openMenu != 0 && openMenu != 1){
                                    $('#sf-menu-'+openMenu+' li.sfHover ul').hide();
                            }
                    },
                    onShow: function(){
                            openMenu = 1;
                    },
                    onHide: function(){
                            openMenu = 0;
                    }
            });
    });

















which... sometimes works, sometimes doesn't.

I've also tried variations of:
  1. $('#sf-menu-'+openMenu+' li.sfHover').hideSuperfishUI($('#sf-menu-'+openMenu)[o].o);
(Joel's suggestion), but it doesn't work at all. The error is that "o is not defined". If I remove the (mysterious, for me) o variable, the error changes to:
  1. $('#sf-menu-'+openMenu+' li.sfHover').hideSuperfishUI is not a function
Thank you for any help!















Cristina R.