For a site I designed I needed to theme each menu item with a different color. In order to do this each list item needed a unique HTML id.

I wrote the attached patch against JQuery Menu version 6.x-3.3.

Basically the patch adds an option on the JQuery Menu configuration page to turn list item IDs on or off.

If the feature is enabled, then it will create html something like this

<ul>
 <li id='jqmenu-1-1'>First List Item</li>
 <li id='jqmenu-1-2'>Second List Item
  <ul>
    <li id='jqmenu-1-2-1'>Second Item, first child</li>
    <li id='jqmenu-1-2-2'>Second Item, second child</li>
  </ul>
  </li>
</ul>

The first number designates the jquery menu (in case you have multiple jquery menus on the same page)

The second number designates the list item number for the top level

The third, forth, etc number designates the list item number for that level

CommentFileSizeAuthor
#1 jquerymenu-6.x-3.3_html_id.patch3.11 KBrpanna
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rpanna’s picture

Status: Active » Needs review
FileSize
3.11 KB

See attached patch to implement this feature

buttonwillowsix’s picture

This is great and exactly what I needed! Thanks rpanna!

Hopefully this patch will make it into the next version?

Initially I had hoped to use the module "Menu CSS Names", but that didn't integrate with JQuery Menu.