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

Showmenu2 parent item niet klikbaar

(1/2) > >>

mgeene:
Hallo,

Ik heb een menu met submenu gemaakt maar ik wil dat het parent menu niet klikbaar is, dus wel dat het submenu zichtbaar wordt als je er met de cursor overheen gaat. Is dit mogelijk? Ik heb de parent link aangemaakt met "menu_link", alleen zo blijft de knop klikbaar.

Alvast bedankt voor je reactie.

Gast:
you need a solution like this here -> https://forum.WebsiteBaker.org/index.php/topic,26238.msg202469.html#msg202469

the important part is the first definition of $open. for a better view and understanding, i split this code in lines

--- Quote ---$open = '<li class="[if(class=menu-current||class=menu-parent){active}] [if(class==menu-expand){dropdown}]">
[if(class==menu-expand&&level==1)
{<a href="[url]" class="dropdown-toggle" data-toggle="dropdown">[menu_title] <b class="caret"></b></a>}
else
{<a href="[url]">[menu_title]</a>}
]';
--- End quote ---

purple: set the css-class "active" for the current and his parent menu-item (maybe important for a arrow-icon)
brown: set the css-class "dropdown", if this item has childs - needed in the example for bootstrap
red: condition for the A-links in level 1, here only, if class "menu-expand" and also level 1
green:  build the link for this condition, thats the point to changed for you
blue:    solution, if the condition (red) not work - means: in all other levels

i'm not sure, what you need, but if i understand your post correct, change the red condition nearly to
[if(level==1)  or [if(level==0) - dont know, where your start level is

and the green line to the code, that you need for the items in level 1 or level 0, maybe a simple
<span>[menu_title</span>

thats the way

mgeene:
Thanks for your reply, but it doesn't work, the menu item is still clickable.

Gast:
is it possible, to show us the actual show_menu2-call and some details about the page structure?

mgeene:
Here is the call of show_menu2:


--- Code: ---
<?php       
$open = '<li class="[if(class=menu-current||class=menu-parent){active}] [if(class==menu-expand){dropdown}]">
[if(class==menu-expand&&level==1)
{<a href="[url]" class="dropdown-toggle" data-toggle="dropdown">[menu_title] <b class="caret"></b></a>}
else
{<a href="[url]">[menu_title]</a>}
]';

ob_start(); 
show_menu2(
$aMenu          = 1,
$aStart         = SM2_ROOT, 
$aMaxLevel      = SM2_ALL,
$aOptions       = SM2_ALL,
$aItemOpen      = $open,
$aItemClose     = '</li>',
$aMenuOpen      = '<ul>',
$aMenuClose     = '<li class="ulend"></li></ul>',
$aTopItemOpen   = true,
$aTopMenuOpen   = '<ul id="mobile" class="navmenu">'
);
$topmenu = ob_get_contents();
        ob_end_clean();

?>


--- End code ---

And the page structure is that i have some the parent menu-items and under some parent menu-items i have 4 or 5 sub pages and where i have sub pages i want that the parent menu-item not clickable is. The page structure is verry simple.

Navigation

[0] Message Index

[#] Next page

Go to full version