Would like to request a feature so that the menu for the parent of an active child is expanded on the page, rather than being "closed" and accessible only through the CSS drop down/fly out navigation of nice menus.

Can be seen in action with both this expansion and a fly out menu at:
http://www.thecrossingsaustin.com/spa/index.php?sec=6

However, that site rolled their own - this would be a phenomenal add in a single module - possible in Nice Menus?

Comments

netmansam’s picture

In case it helps anyone here, I went ahead and rolled my own based on Son of Suckerfish (until the nifty Nice Menus module can handle this at least). Feel free to borrow the code from http://www.sunrisesprings.com/

I had to assign a class to ancestors of the current active page, using the basic idea from http://drupal.org/node/87902 but with the changes to assign it to the li element rather than the a:

function phptemplate_menu_item($mid, $children = '', $leaf = TRUE) {
  $active_class = in_array($mid, _menu_get_active_trail()) ? ' active-trail' : '';
  return '<li class="'. ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) . $active_class .'">'. menu_item_link($mid) . $children ."</li>\n";
}

I had to include the IE7 fix for Son of Suckerfish in the header, from http://www.builtfromsource.com/2006/10/23/a-fix-for-suckerfish-dropdowns... which was:

<!--[if IE]><style type="text/css">.content ul.menu li:hover {position: static;}</style><![endif]-->

Since Drupal's menu ul and li elements are only assigned classes, I had to make sure that my menu was contained in some unique ID element on the page (OK if there are other things in that element besides the menu), because the IE javascript code for son of suckerfish uses getelementbyid and needs and ID to latch onto and search for LI elements

Then it was a matter of balancing the code to tell son of suckerfish to act on all class=expanded li/ul combos, and then afterwards set anything with a class of active-trail to not exhibit son of suckerfish behavior (clear: both, position: relative, left: auto, display: block)

A little complicated, but it works now.

Please still keep my request in to have Nice Menus incorporate this feature - we'll promote it as far and wide as we can if it could only do this.

add1sun’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

We'll put new features in the 5 version. This looks like cool stuff. Is it possible you can actually roll a patch against the current nice menus dev?

nlink’s picture

Category: feature » support

Any ideas how to get this thing working on Drupal 5.x installation. I am fairly new to Drupal and need this done on my site.

Currently it either shows all menus in expanded state or non expanded state. I want to use sliding menu for the same. Will be glad if there is some step by step instruction or installation available.

Thanks.

netmansam’s picture

nlink,

You set all menus to be expanded.

Then, the son of suckerfish CSS will actually turn those into drop-down/out menus. NOTHING will actually BE expanded, but the menus need to all be set as expanded so that the nested UL UL code exists for the CSS to act upon.

Feel free to follow what I did in reply #1 and at that sunrisesprings.com website - it works!

The only bizarre thing I've noticed is that periodically, some of the menus revert back to an unexpanded state - which won't work, obviously.

add1sun’s picture

Category: support » feature

Moving to feature request

add1sun’s picture

Version: 5.x-1.x-dev » 6.x-2.x-dev

Moving all feature requests to HEAD. We'll work on new features after the port to 6 is complete. This one is not high on my list so if anyone else would like to see this, please provide a patch.

add1sun’s picture

Status: Active » Closed (fixed)

No one seems interested in picking this one up so I am closing this issue.