WebsiteBaker Support (2.8.x) > Templates, Menus & Design
showmenu
mdemaree99:
--- Quote from: marmot on June 25, 2012, 09:30:40 PM ---2) If you have jquery on your page and don't want to touch the original SM2 code, you can put this script in the head section of your template (of course after jquery is loaded):
--- Code: --- <script>
$(document).ready(function () {
$('.menu-0').each(function(index){
$(this).addClass('menuColor'+index);
});
});
</script>
--- End code ---
, where 0 in menu-0 is the level of the menu.
Then you can define styles in your css selecting like this:
--- Code: ---.menu a.menuColor1 {
color: #00F;
}
--- End code ---
, where 1 of menuColor1 is the number of the menuitem, starting with 0.
--- End quote ---
Seems like I have several jquery files loading so I like option 2, but a little confused on what is the variable I would use for the class. I have tried menucolor[index] and a few other options, but not quite sure the code.
<?php show_menu2(0, SM2_ROOT+1, SM2_ALL, SM2_ALL|SM2_CURRTREE, '<li><a href="[url]" class="
menuColor[index]">[menu_title]</a>', "</li>", '<ul class="ullev[level]">', "</ul>", true, '<ul id="header_menu" class="menu"><li class="home"></li>');
?>
marmot:
Hi,
--- Quote from: mdemaree99 on June 26, 2012, 05:51:47 AM ---Seems like I have several jquery files loading so I like option 2, but a little confused on what is the variable I would use for the class. I have tried menucolor[index] and a few other options, but not quite sure the code.
--- End quote ---
to use this you just have to use the SM2 Paramenter SM2_NUMCLASS. The javascript will add the unique class to the link. Just define the style how you like it. Thats all! You don't have to care for classes.
regards
Navigation
[0] Message Index
[*] Previous page
Go to full version