We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28475
    • 28 Posts
    Hi guys,
    I copied everything basically directly off of http://muddydogpaws.com/development/wayfinder/examples/example-2.html (the basic drop down menu for wayfinder), changed the syntax to [[+ ]] and such.
    The menu is supposed to be horizontal, but what happens instead, is it ends up being vertical. Thing is, it worked well with two menu items, but when I started adding more it went haywire. I’ve wasted all day looking for a fix but I’m an amateur.

    Here are my chunks:
    cssplay_basicdd:
    <link rel="stylesheet" media="all" type="text/css" href="../css/basic_dd.css" />
    <!--[if lte IE 6]>
    <link rel="stylesheet" media="all" type="text/css" href="../css/basic_dd_ie.css" />
    <![endif]-->
    
    cssplay_inner:
    <ul>
        [[+wf.wrapper]]
    </ul>
    
    cssplay_outer:
    <div[[+wf.classes]]>
        <ul>
            [[+wf.wrapper]]
        </ul>
    </div>
    
    cssplay_parentRow:
    <li><a [[+wf.classes]] href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a>
        <!--[if lte IE 6]>
        <a class="sub" href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]
        <table><tr><td>
        <![endif]-->
        [[+wf.wrapper]]
        <!--[if lte IE 6]>
    	</td></tr></table>
        </a>
        <![endif]-->
    </li>
    
    cssplay_row:
    <li[[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a>[[+wf.wrapper]]</li>
    


    The CSS:
    /* common styling */
    /* set up the overall width of the menu div, the font and the margins */
    
    .menu {
    font-family: helvetica, arial, sans-serif; 
    width:960px; 
    margin:0;
    position:relative;
    z-index:100;
    }
    /* remove the bullets and set the margin and padding to zero for the unordered list */
    .menu ul {
    padding:0; 
    margin:0;
    list-style-type: none;
    }
    /* float the list so that the items are in a line and their position relative so that the drop down list will appear in the right place underneath each list item */
    .menu ul li {
    float:left; 
    position:relative;
    }
    /* style the links to be 104px wide by 30px high with a top and right border 1px solid white. Set the background color and the font size. */
    .menu ul li a, .menu ul li a:visited {
    display:block; 
    text-align:center; 
    text-decoration:none; 
    width:100px; 
    height:36px; 
    color:#f3eee8;
    border:0;
    background:#491a02; 
    line-height:36px; 
    font-size:14px;
    font-weight:bold;
    }
    /* make the dropdown ul invisible */
    .menu ul li ul {
    display: none;
    }
    
    /* specific to non IE browsers */
    /* set the background and foreground color of the main menu li on hover */
    .menu ul li:hover a {
    color:#fff; 
    background:#5a2b13;
    }
    /* make the sub menu ul visible and position it beneath the main menu list item */
    .menu ul li:hover ul {
    display:block; 
    position:absolute; 
    top:36px; 
    left:0; 
    width:100px;
    }
    /* style the background and foreground color of the submenu links */
    .menu ul li:hover ul li a {
    display:block; 
    background:#491a02; 
    color:#f3eee8;
    }
    /* style the background and forground colors of the links on hover */
    .menu ul li:hover ul li a:hover {
    background:#5a2b13; 
    color:#fff;
    }
    


    The snippet call:
    [[!Wayfinder? &startId=`0` &level=`3` &parentClass=`hide` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &outerClass=`menu` &cssTpl=`cssplay_basicdd` &excludeDocs=`2`]]
    


    The strange thing is in the output html, for some reason, wayfinder gives all the li elements (apart from first active and last) a class of "menu", which is what breaks the menu. But I have no idea how to fix it. Here’s the output html:
    <div class="menu"> 
       <ul> 
          <li class="first">
              <a href="___" title="___">___</a>
          </li>
          <li class="menu">
              <a href="___" title="___">___</a>
          </li>
          <li class="menu">
              <a href="___" title="___">___</a>
          </li>
          <li class="menu">
              <a href="___" title="___">___</a>
          </li>
          <li class="last">
              <a href="___" title="___">___</a>
          </li> 
       </ul> 
    </div>
    

    (i blanked out the titles and stuff because they aren’t important)
      • 26016
      • 561 Posts
      Hi,
      You’ve got some big brass ones, trying a Stu menu as a beginner! smiley You’re doing well with your Revo code, too, so high marks for that.

      I have a couple quick thoughts... I’ve used menus based on those demos once or twice, including a drop-up. Styling those was a huge workout for a non-beginner!

      The first thing to watch out for with these demos is very simple, although you may have thought of it. What Kyle doesn’t tell you is that he’s including more CSS than you think... example 2 uses this CSS. Are you pulling it in?

      /assets/templates/wayfinder/basic_dd.css

      Great. And if you use any other demos, check carefully to see what other special CSS is being pulled in.

      I can’t see what you have, but I’ll give a couple more thoughts. Your LI’s with "menu" on them are stemming from this:

      &outerClass=`menu`


      And in short, your menu call and chunks will give you that on any LI that’s not a parent of other lists, except, as you say, for last and first. Pull that parm out of the call, and see if that helps. Beyond that, it’s impossible to diagnose without knowing more about your situation, like a link. Maybe that will get you started.

      Dave


        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
        • 22427
        • 793 Posts
        I’m not sure, but I think if you use [tt]&outerClass[/tt] without defining an [tt]&innerClass[/tt] , the [tt]&outerClass[/tt] will be taken for the inner part as well.
        So perhaps it may help to define an additional empty [tt]&innerClass=``[/tt] to override this behaviour. (Not tested, just a guess.)
          • 28475
          • 28 Posts
          Hmm, I assumed that the chunks that were given in the example were all complete and didn’t need editing :/
          I did indeed link the CSS though... shouldn’t the chunk pull from this bit of CSS for li styling though?:

          .menu ul li {
          float:left; 
          position:relative;
          }
          


          ...and not the .menu bit? In any case, I don’t know all the details of how CSS works. I did manage to fix the problem, I think (well the menu works as it should anyways), by editing the cssplay_row chunk:

          <li[[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a>[[+wf.wrapper]]</li>


          and removing the [[+wf.classes]] from <li>

          <li><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a>[[+wf.wrapper]]</li>


          this removed the class="menu" from my <li>s (but also the first and last classes undecided)

          Here’s a link to the site in question: http://www.saskatoonaikido.ca/
            • 26016
            • 561 Posts
            Quote from: stenzor at Jan 05, 2011, 02:29 PM

            Hmm, I assumed that the chunks that were given in the example were all complete and didn’t need editing :/
            I did indeed link the CSS though... shouldn’t the chunk pull from this bit of CSS for li styling though?:

            .menu ul li {
            float:left; 
            position:relative;
            }
            


            ...and not the .menu bit? In any case, I don’t know all the details of how CSS works. I did manage to fix the problem, I think (well the menu works as it should anyways), by editing the cssplay_row chunk:

            <li[[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a>[[+wf.wrapper]]</li>


            There’s one thing you’re not taking into account, even though the demo may work, and may actually use the chunks as listed. Your menu structure may not be the same as the demo. Keep that in mind. IMO, if you assume a demo will work everywhere, you’ll be disappointed almost always.

            Now that I’m looking at the demo, it actually seems dead wrong! In his menu, there’s no good reason to have .menu on an LI. .menu already appears on the outer DIV, and is quite clearly for the dimensions of the whole menu, not one LI. That’s why the last two menu items look very silly under Home - About is as wide as the whole menu??!!!! If you take the .menu off the LI, then these menu items sensible go to the right.

            If I were going to use this menu, I would get rid of "outerclass" altogether, ditch the &outerTpl altogether (and just hard-code it without a class if you need a containing DIV), and then you can use &rowTpl with classes on it again to style first and last items if you want.

            It’s intriguing to me that you’d want to use a dropdown menu when you have only one level. smiley
              MODx and Wordpress development
              Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
              • 28475
              • 28 Posts
              So far I have one level, but I might add some more on later. Thanks for the suggestions. I’ll play around with that for sure.
                • 22427
                • 793 Posts
                Do not assign the class [tt].menu[/tt] to the wrapping [tt]div[/tt] but to the [tt]ul[/tt] element.
                Then if you wrote [tt]ul.menu { }[/tt] instead of [tt].menu { }[/tt] in your css that presumably could help you out.
                (It’s a matter of the specificity of the css selectors - see http://www.w3.org/TR/CSS2/cascade.html .)