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.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


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


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.11.x) »
  • General Help & Support (Moderator: Boudi) »
  • Open submenu after clicking main menu
  • Print
Pages: [1]   Go Down

Author Topic: Open submenu after clicking main menu  (Read 12991 times)

Offline henri

  • Posts: 148
Open submenu after clicking main menu
« on: March 10, 2018, 02:34:02 PM »
Is there a way to change the code below so that the submenu only appears after a mouse click on the main menu item.

<? php
show_menu2 (
0, SM2_ROOT, SM2_ALL, SM2_ALL,
'
  • [if (class == menu-expand && level == 0) {<a> [menu_title] </a>} else {<a href="[url]"> [menu_title] </a> }] ',' </ li> ',
    false,
    false,
    false,
    '<ul class = "nav-menu" id = "main-navigation">'
    );
    ?>
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8914
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Open submenu after clicking main menu
« Reply #1 on: March 10, 2018, 03:36:21 PM »
Hi, for code please use in the editor the code button #
Have you tried TRIM?
Code: [Select]
<?php
show_menu2 
(
    
0, SM2_ROOT, SM2_ALL, SM2_TRIM,
    
'[if (class == menu-expand && level == 0) {<a> [menu_title] </a>} else {<a href="[url]"> [menu_title] </a> }] ',' </ li> ',
    
false,
    
false,
    
false,
    
'<ul class = "nav-menu" id = "main-navigation">'
    
);

If this not work, tell more about what a menu you have and want.
Logged
https://onkel-franky.de

Offline jacobi22

  • Betatester
  • **
  • Posts: 5920
Re: Open submenu after clicking main menu
« Reply #2 on: March 10, 2018, 04:42:41 PM »
Quote from: dbs on March 10, 2018, 03:36:21 PM
<?php
show_menu2 
(
    
0, SM2_ROOT, SM2_ALL, SM2_TRIM,
    
'[if (class == menu-expand && level == 0) {<a> [menu_title] </a>} else {<a href="[url]"> [menu_title] </a> }] ',' </ li> ',
    
false,
    
false,
    
false,
    
'<ul class = "nav-menu" id = "main-navigation">'
    
);


a-tag without href-attribute is invalid, use
Code: [Select]
<a href="#">[menu_title]</a>instead of the simple <a>
Quote
if (class == menu-expand && level == 0)

means: this code behind my quote works only, if an link has at minimum one child (condition: class == menu-expand=
if you need it for all links in the first level of the visible menu, use the level-condition only

HINT: level 0 (zero) is the root of WB and this example works only, if you want to display this root pages (specially for single language pages). Be sure, that you use your favorite level in the condition

Logged

Offline henri

  • Posts: 148
Re: Open submenu after clicking main menu
« Reply #3 on: March 10, 2018, 08:33:15 PM »
Different combinations tried.
The combination below works best but if I use the mouse on the item in the main menu, then the submenu appears immediately.
The submenu should appear after clicking on item in main menu.

<?php
show_menu2(
0,SM2_ROOT, SM2_ALL, SM2_ALL,
'
  • [if (condition:class==menu-expand && level==0) {<a href>[menu_title]</a>} else {<a href="[url]"> [menu_title] </a> }] ',' </ li> ',
    false,
    false,
    false,
    '<ul class="nav-menu" id="main-navigation">'
    );                   
    ?>

    If I use the code below, no submenu will appear after a mouse click on the main menu item.
    If I set the value of level == 0 to 1, the submenu will appear but in the main menu the item that I click with the mouse will also open. What is not the intention.

    <?php
    show_menu2(
    0,SM2_ROOT, SM2_ALL, SM2_TRIM,
    '
    • [if (condition:class==menu-expand && level==0) {<a href="#">[menu_title]</a>} else {<a href="[url]"> [menu_title] </a> }] ',' </ li> ',
      false,
      false,
      false,
      '<ul class="nav-menu" id="main-navigation">'
      );                   
      ?>
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.11.x) »
  • General Help & Support (Moderator: Boudi) »
  • Open submenu after clicking main menu
 

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