WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Menu > Colors
  • Print
Pages: [1]   Go Down

Author Topic: Menu > Colors  (Read 7156 times)

Offline bupaje

  • Posts: 592
Menu > Colors
« on: August 12, 2013, 07:38:51 PM »
I was wondering if there was a way to have a menu with each new 'tab' having a background color assigned automatically, perhaps from a list of predesignated colors?



So I might create a group of descending shades of blue for example and each new top level page added would use the next color from the list? 

As an alternative I guess I could find a way to set a unique ID for each top level menu item and then over ride the background color for each of those but thought I'd ask.



Logged

jacobi22

  • Guest
Re: Menu > Colors
« Reply #1 on: August 12, 2013, 09:20:30 PM »
you can use [sib] as a counter for the menu-childrens and combined this [sib] with a css-class -> class="[class] color[sib]

as example

Code: [Select]
<?php

show_menu2
(1, SM2_ROOT, SM2_START,  SM2_ALL|SM2_TRIM|SM2_PRETTY,'<li><a href="[url]" class="[class] color[sib]"><span>[menu_title]</span></a>', '</li>', '<ul>', '</ul>', false, false);

?>

result is a source-code like this for the menu

Code: [Select]
<!-- show_menu2 -->
 <ul class="menu">
    <li><a href="/wb_jacobi22/" class="menu-expand menu-current menu-first color1"><span>Home</span></a>    </li>
    <li><a href="/wb_jacobi22/webdesign" class="menu-expand menu-sibling color2"><span>Webdesign</span></a>    </li>
    <li><a href="/wb_jacobi22/referenzen" class="menu-expand menu-sibling color3"><span>Referenzen</span></a>    </li>
    <li><a href="/wb_jacobi22/privates" class="menu-expand menu-sibling menu-last color4"><span>Privates</span></a>    </li>
 </ul>

use css-class color1 - color4 for your background-colors
Logged

Offline bupaje

  • Posts: 592
Re: Menu > Colors
« Reply #2 on: August 12, 2013, 11:22:56 PM »
Ah, perfect - thanks very much. :)
Logged

Offline Tez Oner

  • Posts: 257
  • "...it's possible..."
    • VA-MDS / MMO | communications
Re: Menu > Colors
« Reply #3 on: August 13, 2013, 09:04:39 PM »
Hey,

could also be done with CSS using the :nth (child) selector,
eg; ul > li > li:nth-child(2) means that to the 2nd li of any li
can be selected for CSS-styling.

http://illegalistic.nl/pages/posts/applying-a-css-class-to-a-child-object-4.php

Cheerz,

Tez Oner
Logged
Tez | VA-MDS / MMO | communications
--------------------------------------------
info@va-mds.com / http://va-mds.com

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Menu > Colors
« Reply #4 on: August 13, 2013, 09:09:02 PM »
One downside to using :nth-child in css:
Quote from: http://www.w3schools.com/cssref/sel_nth-child.asp
The :nth-child() selector is supported in all major browsers, except IE8 and earlier.
Logged

Offline Tez Oner

  • Posts: 257
  • "...it's possible..."
    • VA-MDS / MMO | communications
Re: Menu > Colors
« Reply #5 on: August 14, 2013, 11:35:06 PM »
Hey,

indeed a pity for IE8 users ;) in this case check what the target group
of the website is... IE8 was released in yes... 2009 some few months and
it's 5 years old and it's about 10% of total browser usage.

http://www.sitepoint.com/browser-trends-may-2013/

Cheerz,

Tez Oner
Logged
Tez | VA-MDS / MMO | communications
--------------------------------------------
info@va-mds.com / http://va-mds.com

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Menu > Colors
« Reply #6 on: August 14, 2013, 11:48:06 PM »
I know.
But you have to take it in as considoration, to support or not support IE8 and <.

I guess you can check for yourselfe (google analytics). Then you know if your target group needs backward compatibility.
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Menu > Colors
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2