We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28853
    • 34 Posts
    Is it possible to create a menu that expand the sublevels as i click them? I only want level1 shown at first, then when i click a menuitem that has sub-folder/documents i want them to expand.

    Anyone done this with dropmenu and wants to share the code? wink
      • 25663 MODX Staff
      • 12,272 Posts
      That would require some custom code and an onclick behavior or an unobtrusive Javascript implementation that attaches itself to the Menu ID upon page load. Defintitely a cool idea, but a bit beyond the scope of the current DropMenu snippet.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 28853
        • 34 Posts
        Is there any other way to get expandeble menus in modxcms? I really need one, and im a lousy coder embarrassed

        Check example here: http://www.vasterbottensmuseum.se/arkeologi/
        nevermind the language, just click the left menuitems wink
          • 1764
          • 680 Posts
          I have an accordian type menu (only two levels deep) working with dropmenu with just a couple of simple hacks. If you want something that is an infinite level javascript menu that will be more difficult.

          With the accordian style all you have to do is get a class name for each <li> with a <ul> in it and a class for each sub <ul> (not the top one) and then associate a moo.fx accordian function with it (only three lines of code). If you’d like to do something like that let me know and I can email my hacked DropMenu and some other things to you.
            • 28853
            • 34 Posts
            Would be great! Can it be done to work with 3 or 4 levels?

            You can mail it to me: johans (at) mjao.net
              • 17883
              • 1,039 Posts
              Is it possible to create a menu that expand the sublevels as i click them? I only want level1 shown at first, then when i click a menuitem that has sub-folder/documents i want them to expand.

              Check example here: http://www.vasterbottensmuseum.se/arkeologi/

              I don´t see the necessity for Javascript or any modification of the dropmenu snippet. Just simple CSS.

              Here is a copy of a menu I used on a site, but then the multilevel-solution wasn´t necessary anymore, so I don´t know if it works at once (and there´s a lot of design stuff in it, but I think you´ll find out). The thing is to hide the sublevels until they get active. The call for the dropmenu has in that case was:

              [[DropMenu? &menuName=`leftMenu` &startDoc=`2` &levelLimit=`0` &topnavClass=`leftMenubar` &hereClass=`activeLink`]]

              the CSS for that:

              ul.leftMenubar {
              font-size: 0.75em;
              }
              
              ul.leftMenubar li{
              border-bottom: 1px solid #CCCCCC;
              line-height: 2.5em;
              font-weight: bold;
              font-size: 1em;
              color: #6497D7;
              text-indent: 10px;
              }
              
              ul.leftMenubar li ul {
              display: none;
              }
              
              ul.leftMenubar li.activeLink ul{
              display: block;
              }
              
              ul.leftMenubar li.activeLink ul li ul{
              display: none;
              }
              
              ul.leftMenubar li ul li.activeLink ul{
              display: block;
              }
              
              ul.leftMenubar li a{
              text-decoration: none;
              font-weight: bold;
              color: #6497D7;
              line-height: 20px;
              }
              
              ul.leftMenubar li li{
              border-top: 1px solid #CCCCCC;
              background: #FFFDF4;
              border-bottom: 0px;
              font-size: 1em;
              }
              
              ul.leftMenubar li li a{
              font-weight: normal;
              }
              
              ul.leftMenubar li.activeLink{
              background: #FFFBE8;
              }
              
              ul.leftMenubar li li.activeLink{
              background: #FFF;
              }
              
              ul.leftMenubar li li a{
              padding-left: 20px;
              }
              
              ul.leftMenubar li li.activeLink a{
              background: url(images/back_list.gif) 2px -2px no-repeat;
              }
              
              ul.topMenubar li.activeLink, ul.topMenubar li.activeLink a{
              font-weight: bold;
              }


              Greetz Marc
                • 6726
                • 7,075 Posts
                That’s a pretty good demonstration of the power of pure css menu smiley

                No javascript needed of course, and DropMenu is pretty well built to exploit this kind of css trick grin
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                  • 28853
                  • 34 Posts
                  You guys are Heros!

                  After just a quick test it seems to work great, gonna try it out some more tomorrow, getting a little late overhere in sweden wink

                  Thanks all, and Marc, thanks for the code!
                    • 25663 MODX Staff
                    • 12,272 Posts
                    JS would be needed because he said he wanted to make it appear when clicking. I prefer hovers and pure CSS myself too. smiley Ahh... I was thinking dropdown menus like the operating system file menus... doh!
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 1764
                      • 680 Posts
                      Quote from: MadeMyDay at Feb 15, 2006, 03:53 PM

                      I don´t see the necessity for Javascript or any modification of the dropmenu snippet. Just simple CSS.

                      You’re right, I didn’t check the example link smiley

                      I can send you the code if you like but it will use javascript and it will be a two-level limit.