Two menu bars

VVW - July 3, 2009 - 12:31

Hi,

Just got my first drupal site up-and-running and I am now busy working on the theme. I would like to have a static and a dynamic menu bar (like www.ziggo.nl). I have done some searching but I can't figure out how to get this done. Any ideas?

Thanks,

Henry

Found it: setting the sources

VVW - July 3, 2009 - 13:16

Found it: setting the sources for both primary en secundary links did the trik

was a bit late with my reply.

gollyg - July 3, 2009 - 13:18

was a bit late with my reply. glad you found it

If you want to make a top

gollyg - July 3, 2009 - 13:17

If you want to make a top level and second level navigation, with the second level navigation changing based upon the main category selected, you can set this up in the menu settings page. Create your primary links menu (or a new menu if you want) including your second level items. Then on the menu setting page set your primary menu and secondary menu to both point to this menu.

Make sure your theme implements both primary and secondary links (try on a default drupal theme first).

You should find that the nav now behaves the way you want it to.

Although this is a solution,

VVW - July 3, 2009 - 14:53

Although this is a solution, I have to click on the primary link to let the secondary link change. On the site I mentioned the secondary link changes when hovering over the primary. How can this be achieved?

This would be a js solution,

gollyg - July 3, 2009 - 21:16

This would be a js solution, so you would need to either:
load the entire second level menu onto the page and then hide it (recommended from both a performance and accessibility point of view)
make ahah/ajax request to load the menus.

Then it would simply hide or show a specific menu based upon the mouseover state of the main menu.

So all you really need to worry about from a drupal page perspective is getting the menu on the page, with enough useful ids on the menus to allow js interaction, and finding a way of printing out all of your second level menus. This may require theming the primary links menu via its associated theme function. Then, of course, you would need to build the jquery.

It would probably be the easiest to leave all of your menu items in the primary links menu (this will give you nicer breadcrumbs), set the secondary links to 'expanded' in the menu settings, and then print the entire primary menu into a sidebar/region via a block. Then your jquery would kick in to make it look how you want.

 
 

Drupal is a registered trademark of Dries Buytaert.