We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30793
    • 6 Posts
    Hello. I’m a new user to modx, in fact this is my first foray into the world of CMS and I have to say it’s really opened up a world of possibilities, but I’m also getting bogged down on little technicalities which are driving me mad trying to figure them out.

    At the moment I’m stuck on styling my Wayfinder menu to look like the menu I’ve produced in Dreamweaver (image attached). I’ve used the accordion menu from here

    http://www.kunane.com/modx/wayfinder-nested-accordion.html

    and this is working OK but I want it to look like the attached image. The top 4 links will be static and the bottom 2 have submenus so use the accordion function. The main problem styling the parent and child elements differently and also getting the horizontal rules in between the bottom 2 menus. I’m using modx revolution

    thanks

    Matt

      • 23299
      • 1,161 Posts
      Is there a javascript used to produce the menu effect? That can complicate things as you are dealing with multiple things at the same time (jquery, MODx, Wayfinder, and CSS)

      I would leave scripts out for now - get the menu working with Wayfinder as you intend it to. This sounds like a CSS issue to me. Have you tried exploring the menu function with a Firebug widget in your browser? I find that is really helpful as it visually shows what part of your code is relevant when you highlight certain areas. It also helps identify pieces of CSS that might need to be added to your stylesheet.

      But its hard to tell without seeing your code here...

      Welcome to MODx by the way...
        • 30793
        • 6 Posts
        thanks. It does use javascript. The thing I don’t understand is how to apply the CSS, in my original code I could add classes to the individual ’li’ elements but because wayfinder builds the code itself I don’t know how I can accomplish this. I’m probably being thick but I’m only a designer not really a coder : )
          • 22427
          • 793 Posts
          The main problem styling the parent and child elements differently and also getting the horizontal rules in between the bottom 2 menus.
          That is indeed a question of CSS styling.
          Normally Wayfinder will create nested unordered lists; so I assume the output looks like that:
          <ul>
          <li>home</li>
          <li>about</li>
          <li>blog</li>
          <li>contact</li>
          <li>work
              <ul>
              <li>PivotX</li>
              <li>WordPress</li>
              <li>Textpattern</li>
              <li>Typo</li>
              </ul>
          </li>
          <li>archive
              <ul>
              .......
              </ul>
          </li>
          </ul>
          

          Then in the CSS you need a rule
          ul li {
            /* Styling of the first level items here */
          }
          
          and a rule
          ul li ul li {
            /* Styling of the second level items here */
          }
          

          To get the horizontal rulers I would use borders for the [tt]ul li[/tt] like
          ul li {
            .......
            border-top: 1px solid grey;
          }
          
          But then you get them between the top items too.

          To avoid this you could, instead, use an extra class:
          ul li.haschildren {
            border-top: 1px solid grey;
          }
          
          and use it in the parameter [tt]&parentClass=`haschildren`[/tt] .
          Of course, for the items without children you need to keep the rule without border:
          ul li {
            .......
          }
          

            • 23299
            • 1,161 Posts
            I built a site with this kind of system. It is an "ambitious" project shall we say.

            One of the things I found worth doing was to build a very, very simple static page with one CSS file and a folder for the jquery. Once I could get the system working with my custom CSS I then set about adding it a Wayfinder system within MODx.

            My call looks like this:
            [[Wayfinder? &startId=`0` &level=`2` &outerTpl=`jqaccoutertpl` &innerTpl=`jqaccinnertpl` &rowTpl=`jqaccrowtpl`]]


            I need to upgrade the version of Evo that this site runs on, which might mean I will be updating the jquery and this script as well.
              • 30793
              • 6 Posts
              ottogal you beautiful human being! This works a treat, I’ve still some messing about to get it exactly how I need it to look visually but this works a treat.

              Thanks.