We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45900
    • 53 Posts
    I have made the menu using css to show and hide submenu. The html structure is pretty much the same as the wayfinder default. So I there is no need to use tpl. However I would like to show submenu on one or two parent menus.
    My original thought is to assign specific class to the parent menu so that I can control show and hide in css.

    Any suggestion?

    Thank you
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can have "category folder" items by using the categoryFoldersTpl property
      &categoryFoldersTpl - Name of the chunk containing the template for category folders. Category folders are determined by setting the template to blank or by setting the link attributes field to rel="category".
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 16899
        • 284 Posts
        Quote from: joyobject at Dec 23, 2013, 04:08 AM
        I have made the menu using css to show and hide submenu. The html structure is pretty much the same as the wayfinder default. So I there is no need to use tpl. However I would like to show submenu on one or two parent menus.
        My original thought is to assign specific class to the parent menu so that I can control show and hide in css.

        Any suggestion?

        Thank you

        So you just want to create a way to show hide submenus?

        Let´s say you have an output like this:

        <ul>
            <li class="item-with-childs"><span class="toggle-btn">Toggle</span> Item 1
                <ul class="sub-items">
                    <li>Sub Item 1</li>
                    <li>Sub Item 2</li>
                    <li>Sub Item 3</li>
                </ul>
            </li>
            <li class="item-with-childs"><span class="toggle-btn">Toggle</span> Item 2
                <ul class="sub-items">
                    <li>Sub Item 1</li>
                    <li>Sub Item 2</li>
                    <li>Sub Item 3</li>
                </ul>
            </li>
        </ul>
        


        Then with some little jQuery function you´ll do the magic:

        $(function(){
        	
        	// I recommend hide the menus with CSS
        	$(".sub-items").hide();
        
        	$(".toggle-btn").on("click", function(){
        		$(this).next(".sub-items").slideToggle();
        	});
        
        });
        


        Of course you then you have to access the wayfinder templates to add the classes to have a menu like this one working!!! smiley

        I hope i could help you!!! smiley
          • 16899
          • 284 Posts
          Quote from: joyobject at Dec 23, 2013, 04:08 AM
          I have made the menu using css to show and hide submenu. The html structure is pretty much the same as the wayfinder default. So I there is no need to use tpl. However I would like to show submenu on one or two parent menus.
          My original thought is to assign specific class to the parent menu so that I can control show and hide in css.

          Any suggestion?

          Thank you

          So you just want to create a way to show hide submenus?

          Let´s say you have an output like this:

          <ul>
              <li class="item-with-childs"><span class="toggle-btn">Toggle</span> Item 1
                  <ul class="sub-items">
                      <li>Sub Item 1</li>
                      <li>Sub Item 2</li>
                      <li>Sub Item 3</li>
                  </ul>
              </li>
              <li class="item-with-childs"><span class="toggle-btn">Toggle</span> Item 2
                  <ul class="sub-items">
                      <li>Sub Item 1</li>
                      <li>Sub Item 2</li>
                      <li>Sub Item 3</li>
                  </ul>
              </li>
          </ul>
          


          Then with some little jQuery function you´ll do the magic:

          $(function(){
          	
          	// I recommend hide the menus with CSS
          	$(".sub-items").hide();
          
          	$(".toggle-btn").on("click", function(){
          		$(this).next(".sub-items").slideToggle();
          	});
          
          });
          


          Of course you then you have to access the wayfinder templates to add the classes to have a menu like this one working!!! smiley
          If in your folder menu you don´t need to link to anywhere, just put the class toggle-btn on it, remove of course the span... and in your wayfinder template (corresponding to this item, remove the link attribute... use wayfinder just to output the name of your folder item.

          I hope i could help you!!! smiley
            • 45900
            • 53 Posts
            Hey! thank you very much smiley
              • 16899
              • 284 Posts
              Quote from: joyobject at Dec 23, 2013, 05:35 AM
              Hey! thank you very much smiley

              You are welcome!!!! smiley
                • 45900
                • 53 Posts
                Hi legues,

                I have made that work in css. and it works fine. The problem is I want some of the items on the menu to show their children. What I think is to add some class or id on particular main menu item and control thing by using css.

                Thanks
                  • 16899
                  • 284 Posts
                  Quote from: joyobject at Dec 23, 2013, 05:55 AM
                  Hi legues,

                  I have made that work in css. and it works fine. The problem is I want some of the items on the menu to show their children. What I think is to add some class or id on particular main menu item and control thing by using css.

                  Thanks

                  Then you can do it with CSS and jQuery. I´m not sure if you can do it with pure CSS. smiley