WebsiteBaker Support (2.8.x) > Templates, Menus & Design

show_menu2 active state within childpages

(1/1)

noname8:
This always breaks my nerves!  :evil: :? :-(

I have 2 menus, how to make the top on show the active state with all it's children
(even in 1.st level only)

my page structure is [lang]->[mainpages]->[subpages]
so 0. level is just for language

Top menu:

--- Code: ---echo show_menu2(0, 480, SM2_START+1, SM2_TRIM |SM2_NUMCLASS|SM2_PRETTY|SM2_BUFFER, "[li][a][menu_title]</a>", '</li>', '[ul]', '</ul>', false, false);
--- End code ---


When clicked top menu, it gives this html:

--- Quote ---<li class="menu-1 menu-expand menu-current menu-first"><a title="page3" target="_top" href="http://localhost/site/pages/eng/page3.php">Page3</a>    </li>
--- End quote ---

sub menu:

--- Code: ---echo show_menu2(1, SM2_CURR+1, SM2_START, SM2_TRIM |SM2_NUMCLASS|SM2_PRETTY|SM2_BUFFER, "[li][a][menu_title]</a>", '</li>', '[ul]', '</ul>', false, false);
--- End code ---

ruebenwurzel:
Hello,

try to style the .menu-parent in your css.

Matthias

noname8:
Thank you
That will also style the not-currently-opened menu items.
What i meant that was to show the active state

jacobi22:

--- Quote ---That will also style the not-currently-opened menu items.
--- End quote ---
  :? :?

i didnt understand...

i have a vertical main menu and a submenu in the top (see pic), 2 menu-codes with separat ID for every menu

if i navigate only in main pages, the submenu is empty. if i click on the link "Tennis", this link becomes the class "menu-current" and the submenu open, if i click on a link in this submenu, the main link "Tennis" becomes the class "menu-parent" (and only this link) and the clicked link from the submenu becomes the class "menu-current"

if you have  same menus like that, you have to separat the classes in the css-file with the menu-ID, like this

mainlevel-nav is the ID for my submenu

--- Code: ---ul#mainlevel-nav li a.menu-current
{       color: #ff0000;
}
--- End code ---

my mainmenu has no ID, only the class mainlevel, i use the the DIV (container1) around the main menu in the css

--- Code: ---#container1 a.menu-parent{color:#00ff00;}
#container1 a.menu-current{color:#ffff00;}
--- End code ---

the pic: if i click on the main page "Tennis", the link is yellow = menu-current, if i click on a subpage from "Tennis", Tennis-Link is green ( menu-parent) and the current page in submenu is red

noname8:
Thank you Thank you  Thank you !

I have somehow confused menu-expand and menu-parent ! With this menu-parent it works like charm!

Navigation

[0] Message Index

Go to full version