We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4980
    • 26 Posts
    have a dropdown menu using | as a separator with border-right. it looks like:

    menuitem1 | menuitem2 | menuitem3 |

    i can remove the final separator by using:
    .menu li.last {border-right: none;}
    however, this only works for a parent item with no children. when a menu item has children .last is applied to the last <li> under the parent.

    is there a way to apply a class to the last parent <li> or another way to remove the final separator? i remember reading a post to that effect but for the life of me, i can’t locate it.

    thanks, chas
      • 20413
      • 2,877 Posts
      Try get this into the tpl’s
      <div style="width:390px;overflow:hidden;margin:0px;padding-left:0px;padding-right:5px;padding-bottom:5px;padding-top:5px;">
      <ul style="list-style-type:none;float:left;width:390px;margin-left:-1px;padding:0px;">
      <li style="display:inline;border-left:1px solid #fff;width:85px"><a href="#" style="margin-left:5px;">Item</a></li>
      <li style="display:inline;border-left:1px solid #fff;width:85px"><a href="#" style="margin-left:5px;">Item</a></li>
      <li style="display:inline;border-left:1px solid #fff;width:85px"><a href="#" style="margin-left:5px;">Item</a></li>
      </ul>
      </div>

      Output - one item <li>:
      Item
      Output - many items <li>:
      Item | Item | Item | Item | Item | Item | Item
      Item | Item | Item | Item


      The overflow:hidden might screw up the dropdown... But I think it’s safe because we don’t set height.

      In that case try positioning a background image with the separator in the last or first class (see sharkbait reply below)!
      http://modxcms.com/forums/index.php/topic,27650.msg167941.html#msg167941
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 26931
        • 2,314 Posts
        anonymized-26931 Reply #3, 17 years ago
        however, this only works for a parent item with no children
        ...hope i understand you right

        you probably need to create an InnerRow-Template in your Wayfinder call...like this:

        create a chunk e.g. called "submenuRows" with the content:
        <li[+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>

        now add &innerRowTpl=`submenuRows` to your wayfinder call and you should have the .last class added to your last menu-item in your nested UL

        from the wayfinder e-book around page 39: http://modxcms.com/forums/index.php/topic,34176.0.html

        hope i could help, j
          • 4980
          • 26 Posts
          thanks guys for the help.
          played around with your ideas and finally stumbled on a simple solution. the problem was how to assign a style or id to the parentrow <li> so i could remove the right border (separator). in my case, the last parentrow <li> had children <li>’s and no style was assigned the parentrow <li> - .last is assigned by default to the last <li> in the group. with children, the last child <li> is assigned .last

          my cssplay_parentRow chunk had no call for classes in the <li>:
          <li ><a [+wf.classes+] href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>....

          so i added wf.classes to the <li> tag & the class appeared:
          <li [+wf.classes+]><a [+wf.classes+] href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a> .....

          my css now worked:
          .menu li.last {border-right: none;}

          chas
            • 10423
            • 1 Posts
            Hi Guys

            I want to do mine another way where is add a | to the end.
            So i have done this:

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

            now I can turn the ’span’ off in css --

            BUT the problem is its not working? when i add teh markup <span> it doe not show up if i leave the words <span> out and simply add the | like this:
            <li [+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>[+wf.wrapper+] | </li>

            it works -- any idea?

            am I not allowed mark-up? am I doing something wrong?

            NEVER mind Fixed -- Was a CACHE problem, worked once I cleared CACHE