Page 1 of 1
assign class to a specific menu item
Posted: Fri Jul 01, 2011 11:13 pm
by pimhd
I would like to assign a class to the link of a specific menu item (the contact page).
I've tried to use the Extra Page Attribute for this and call it from the menu manager but i can get this only to work for the current page. Not for any other item in the menu.
So when I'm on the homepage, I want the contact page link tot look something like this
Code: Select all
<a href="contact" class="fancybox">Contact</a>
Does anyone how to achieve this?
Re: assign class to a specific menu item
Posted: Sat Jul 02, 2011 1:22 am
by Wishbone
Post your menu manager code where you're using Extra1.. We can probably figure it out.
Re: assign class to a specific menu item
Posted: Sun Jul 03, 2011 9:15 pm
by pimhd
I solved it in another way which does it for me.
I used the simple_navigation menu in menu manager and added the lines
Code: Select all
{elseif $node->menutext =='Contact' }
<li><a class="fancybox" href="{$node->url}"><span>{$node->menutext}</span></a>
Ugly programming so if anyone knows a betters solution, Let me know.
Re: assign class to a specific menu item
Posted: Sun Jul 31, 2011 9:16 am
by lordanthony
I add a class to each <li> in menumanager :
You can then define styles for each node eg
Re: assign class to a specific menu item
Posted: Fri Aug 12, 2011 3:46 pm
by kidcardboard
in the menu manager template you can put the following:
Code: Select all
<a href="{$node->url}"{if $node->extra1 != ''} class="{$node->extra1}"{/if}>{$node->menutext}</a>
and then on the page under Extra 1 just put whatever class you want applied to that menu node.
You could also do:
Code: Select all
<a href="{$node->url}" id="{$node->alias}">{$node->menutext}</a>
to give that node a unique id, which might work a little better if you need to just target that single element.