We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11468
    • 20 Posts
    Hi guys

    I am not sure if this has been covered before and there are PAGES of posts already so sorry if this has already been covered!

    I will try and explain.

    I have adapted a dropdown menu from Muddy Paws which is cracking! I then had to make the parent items and their children a certain (and each level a different one) colour on hover. Although I have achieved this, I have done this simply by using rowidprefix and then added each to the relevant css rule. Works but seems a bit long winded lol!

    But I am a bit stumped as there are already classes allocated to make the dropdown work. What I would really like is a way to have classes like say navred, navblue etc. and just allocate this to the appropriate li’s.

    I would then have to have a way of allocating these through the template chunks related to the wayfinder call.

    I am not sure cos I’m quite new to all this; would a TV do this?? I’m not quite sure how this would work although have configured a TV before to add custom ids to <body> of docs.

    I’m sorry guys I need a bit of hand holding ( lol but not spoon feeding wink )

    Hope that makes sense; if not please tell me laugh

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can do this by using the document’s "link attributes" field to have the desired ID. (id="navred") then in your tpl chunk use the [+wf.attributes+] placeholder where you want these to appear.

      You can use class="navred", but then you have to get clever with your templates, and instead of putting class="navred" in the attributes field just put navred, then instead of using [+wf.classnames+] have the class="[+wf.classes+][+wf.attributes+]" attribute in your chunk tpl. I probably have that backwards; I always get it mixed up which one has the full ’class="classname1 classname1"’ and which one just puts in ’classname1 classname2’.
        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
        • 11468
        • 20 Posts
        Thanks so much for your rapid response - again! Ok I’ve had a go at this and it works lovely but because my menu does different things on each page I’m not sure this will work for the children. So atm I’ve used id [+wf.attributes+] just for the parents and then in the css added #navred li a:hover to cover the kiddies laugh

        I think I will maybe use the link attributes in a slightly different way for the other pages’ navigation. But it’s really great to discover this - thanks so much!

        I’m a little confused about your paragraph about class names though? LOL
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Wayfinder has two placeholders, [+wf.classes+] and [+wf.classnames+]. One puts in the whole class="class1 class2" attribute. The other one just puts in the classnames themselves, without the class=" ... " part. A quick look at a handy cheatsheet
          [+wf.classes+] - where classes specifed will be inserted (includes class=" ")
          [+wf.classnames+] - outputs the just the class names (without class=" ")
          So if your chunk tpl has
          class="[+wf.classnames+][+wf.attributes+]" 

          then you can mix up the Wayfinder classes with your own custom ones.
            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
            • 11468
            • 20 Posts
            AH thanks so much ...sorry for being a silly billy rolleyes