Here's a patch that makes primary links drop down, using the jQuery 'superfish' plugin by Joel Birch, http://users.tpg.com.au/j_birch/plugins/superfish/.

Steps:

* dynamically expand the primary links submenus so all levels will display
* generate sub-menus for each primary link, pass them via the Drupal.settings array
* also pass theme-specific selector to identify the primary links element
* in js, iterate through the primary links and append their submenus
* apply the 'superfish' behaviour to the primary links.

This is basically working but needs a fair bit of css work. If anyone wants to wade in and make these improvements, please do!

Steps:

1. improve and genericize the superfish.css file, removing colouring, etc.
2. for each supported theme:
(a) add to or create a themename.css file to put in the activemenu/theme directory, and style the menus there
(b) create a themename.inc file (if one doesn't already exist) identifying the jQuery selector for the primary links page element (see existing examples in this patch).

CommentFileSizeAuthor
activemenu-primary-links.patch7.7 KBnedjo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nedjo’s picture

The patch includes the external file superfish.js. I won't add this to CVS before we resolve the question of whether we can include external libraries.

iaminawe’s picture

This did not work for me with the latest version of jstools on Drupal 5.8

I received the following info in the .rej file

***************
*** 1,8 ****
// $Id: activemenu.js,v 1.21 2007/01/23 22:07:22 nedjo Exp $

Drupal.activemenuAutoAttach = function () {
// The elements supported. Each can designate a different uri.
- var menus = Drupal.settings.activemenu;

for (var menu in menus) {
$(menu + ' li.expanded:not(.activemenu-processed)').each(function () {
--- 1,23 ----
// $Id: activemenu.js,v 1.21 2007/01/23 22:07:22 nedjo Exp $

Drupal.activemenuAutoAttach = function () {
+
+ $(Drupal.settings.activemenu.selectors.primary_links + ':not(.activemenu-processed)')
+ .each(function () {
+ var i = 0;
+ $(this)
+ .addClass('activemenu-processed')
+ .addClass('nav')
+ .find('li')
+ .each(function () {
+ $(this).append(Drupal.settings.activemenu.primaryLinks[i]);
+ i++;
+ })
+ .end()
+ .superfish();
+ })
// The elements supported. Each can designate a different uri.
+ var menus = Drupal.settings.activemenu.menus;

for (var menu in menus) {
$(menu + ' li.expanded:not(.activemenu-processed)').each(function () {

Please help if you can as this is really great functionality to add to JStools.

Thanks