Dude, do you have any clue why the first item in my Navbar style menu might be getting the .sfHover class by default, if I hover over another menuparent it changes, but if I move the mouse away the first menuparents child menu reappears. Its not CSS related at all that I can tell, I can clearly see the sfHover class in Firebug being added, removed, added when I hover the various menu items - I don't have this issue on other sites so I am wondering if it *could* be a problem with some other js on the page - sorry but I cannot publicly tell you the domain (its is live if you want to look...).

Comments

peterparker’s picture

I appear to be having the very same difficulty, with the small exception that it is not the first childmenu which always appears expanded.

Jeff Burnz’s picture

After some digging I can see this is perhaps an issue with the actual Drupal site, although I am not sure at this stage (I'm pretty sure its a bug in one of the modules being used on this site). I enabled the standard menu blocks and the even when I set everything to not-expanded the menu item in question is still expanded.

peterparker’s picture

I am away from the computer for a moment but I fixed the problem last night by changing a false to a true in one of the js files. I don't remember which one, or exactly which line, except that the line was commented along the lines of "hover handler." No adverse effect yet.

asb’s picture

Category:support» feature

Has anyone further investigated this issue? I'm trying to get acertain submenu to expand by default (without hovering over it), so basically I'd like to reproduce the issue you've experienced. Since the superfish plugin supports this behaviour by default and the 'superfish' menu doesn't, I'm changing this issue into a feature request.

According to the superfish documentation for the nav-bar style, this is accomplished by initialising the menu like so:

    $(document).ready(function(){
        $("ul.sf-menu").superfish({
            pathClass:  'current'
        });
    });

I believe that we need a feature to tell Drupal to which menu should get the class 'current' by default.

Any suggestions?

Thanks & greetings, -asb

mehrpadin’s picture

He there,

Both pathClass & pathLevels will be available with the next version, and I'm about to test this module http://drupal.org/project/menu_attributes for the custom class thing, hopefully it'll do the trick.

asb’s picture

Thanks, I believe that pathClass and pathLevels will be a huge leap for the 'Superfish' module (at least if we can figure out how to use it properly ;)

Peacog’s picture

Hi

I have the same problem as the original poster - the child menu is always expanded because for some reason the sfHover class is not being removed from the parent. Did either of you who had the problem fix it, and if so can you share how you did it?

Thanks

Peacog’s picture

I solved my problem. Here's what happened. Because I was concentrating on themeing the menu, I had quickly set it up without creating a unique node for each menu item to point to. I randomly selected nodes for my menu items, and had more than one pointing to <front>. The result of this was that the active-trail was being set for parent items when I wasn't expecting it, and this in turn caused sfHover to be set. So be careful to set up realistic menu structures when you're themeing superfish menus.

Jeff Burnz’s picture

@8, yes, that could have been the problem, this was on a testing site and I did basically the same thing - just threw a menu together. Interesting.

Countzero’s picture

Hi all.

I can tell Pathclass works with the latest dev version on a vertical menu, except for the "revert after hover on another item" feature (see here for a detailed and hopefuly clear explanation http://drupal.org/node/1068236#comment-4187386).

I'm sure my menu structure is OK. I'm using menu_firstchild for some of my top level items but I don't see how it could affect this behaviour.

FYI, 'active-trail' works for most use cases of pathClass.

Any info on this would be unvaluable for me as I'm on the verge of giving up and coding my own thing, which I don't doubt would be worse than this great module.

Peacog’s picture

The child menu will always appear expanded when its parent is in the active trail. What this means in practice for most sites is that the first child menu will always be expanded when you're on the home page, because for most websites the home page is the first menu item i.e. the home page is in the active trail so its child menu is expanded.
There's a little CSS trick you can use to make the child menu invisible until such time as you hover over the parent: just add visibility: hidden to the child menu, something like:

.sf-menu ul {
  visibility: hidden;
}

The child menu will of course come back and stay there if you hover over the parent menu item, but this can help to keep the site looking tidy when you load the home page.

blischalk’s picture

I am experiencing this same issue although I am using version 6.x-1.8. When I am visiting a page in the first level of navigation, the list item's ul dropdown menu is automatically expanded without hover. It seems that this issue has something to do with using a "NavBar" menu type versus a "horizontal" menu type.

Using the NavBar menu type and firebugging the li's I noticed that the .sfHover class would be added to an active first level menu list item even without hovering over it.

I also disabled javascript while using the NavBar menu type and the child ul menu still remained expanded. While firebugging the li's with javascript disabled it seems that the first level list item has the class ".active-trail". This class corresponds to the style .sf-navbar .active-trail ul top: 2.5em on line 21 of superfish-navbar.css which triggers the display of the child ul.

After switching the menu type from NavBar to horizontal the problem seems to go away.

mehrpadin’s picture

Version:6.x-1.8» 6.x-1.6
Status:Closed (fixed)» Active

Buddies,

So sorry, I forgot this for a long time.

Solution: Block configuration > Set "Path Levels" to 0 :)

(Added to the documentation.)

Update: The option 0 for the Path Level will be available with v1.9-beta3.

mehrpadin’s picture

Version:6.x-1.6» 6.x-1.8
Status:Active» Fixed
Shoguo’s picture

I have this same issue, but it's on any parent link I click in the navigation. All of the children stay open and my path levels goes from 1-10, so I can't set it to 0 through block configuration. Using version 7.x-1.8. Suggestions? I've tried just about all the options in block configuration.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mehrpadin’s picture

Issue summary:View changes
Status:Active» Closed (fixed)