Page 1 of 1

Find the last list item dynamically

Posted: Wed Nov 07, 2007 2:19 pm
by HurricaneDan
I need to add styling to a menu.  The menu when viewed as source looks something like this:


  menu 1
  menu 2
   
      submenu 1
      submenu 2
   
 
  menu 3


I need to be able to find the last submenu item for any menu and also find the last menu item so I can add a class/id to it to change the styling like this:


  menu 1
  menu 2
   
      submenu 1
      submenu 2
   
 
  menu 3


Here are my styles as they currently exist.

#gutter_left ul li {
  background-color: #00853f;
  border-bottom:1px solid #FFFFFF;
}
#gutter_left ul li ul li {
  background-color: #00853f;
  border-bottom:1px dashed #FFFFFF;
}
#gutter_left .no_border {
  border-bottom: 0;
}

I need to be able to find the number of list items, dynamically, and apply this if at all possible.

I am not sure what mod/com writes the menus.  Any help would be helpful.

Thanks,

Dan

Re: Find the last list item dynamically

Posted: Thu Nov 08, 2007 8:08 pm
by Opie
Which version? 1.5 or 1.0.x?

Re: Find the last list item dynamically

Posted: Thu Nov 08, 2007 8:25 pm
by HurricaneDan
1.0.13

Thanks,

Dan

Re: Find the last list item dynamically

Posted: Fri Nov 09, 2007 8:05 pm
by Opie
HurricaneDan wrote: 1.0.13

Thanks,

Dan
I'm assuming you are using the stock menu.  You might check this file, /modules/mod_mainmenu.php, as a start.  I'm not certain at this time which line to start looking.  However, I would think if you searched that file for elements you see in your web page source code, you should find the area.

Good luck.