21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 925 Views |
-
Menu with alternating colours

20 October 2009 at 7:55am
I have a menu which creates its top level using code
<% control Menu(1) %>
<% if Children %>
<li ><a href="#" onFocus="if(this.blur)this.blur()" class="$LinkingMode" >$MenuTitle.XML ...I want to change this so that it every second menu option is a different colour i.e. odd it is organge, even it is grey.
To this I want to test against its order in the sitetree (unless someone thinks there is a better way) but I am not sure what this variable is called?
Thanks
Catherine
-
Re: Menu with alternating colours

20 October 2009 at 8:04am Last edited: 20 October 2009 8:06am
The below should work (see http://doc.silverstripe.org/doku.php?id=built-in-page-controls)
<% control Menu(1) %>
<% if Children %>
<li class="$EvenOdd"><a href="#" onFocus="if(this.blur)this.blur()" class="$LinkingMode" >$MenuTitle.XML ...$EvenOdd will return even or odd, so just make two css classes with these names and style as you wish.
--Thomas B. Nielsen
http://www.lund-co.dk -
Re: Menu with alternating colours

20 October 2009 at 8:09am
Hi Thomas
Thank you, worked a treat!
Catherine
| 925 Views | ||
|
Page:
1
|
Go to Top |
