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

    This is a problem that’s really stumping me – I need to have an image dynamically show up as the header depending on which first-level nav item you’re hovering over (including it’s submenus). (i.e. hovering over Home and any of it’s children would show a different image than when hovering over About and any of its children).

    I figured out a semi-easy way to do this through some simple CSS/HTML, but it only works for links I can control by hand – not those automatically generated by Wayfinder. I noticed Wayfinder automatically appends the classes of "first" and "last" to the first and last items of a list, which is super helpful.

    So getting to the point, my main question is, how can I get it to force a different class onto each item all the way down (i.e. first, second, third, fourth, fifth, last), or even just (first + 1, 2, 3, 4, 5, last + 6) so I can individually control them.

    Thanks a lot!! smiley
      • 26507
      • 7 Posts
      The following is the method I wan to use. So if there’s a way to just manually insert these into the first-level "li"s created by Wayfinder (these won’t change so it’s not big deal if they’re not dynamically created like their children), that would work just as well! Thank you!

      <ul>
      <li onmouseover="(document.header.src)='newimage.jpg';" onmouseout="(document.header.src)='defaultimage.jpg';">first-level
      <ul>
      <li>second level</li>
      </ul>
      </li>
      </ul>
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You can use TVS, [+tvname+], in the row-level tpl. The The (almost) Complete Guide to Creating Menus in MODx Using Wayfinder has a section describing how to create a Fisheye menu using an image TV named menutv:
        <li [+wf.classes+]> 
        <a class="dock-item" href="[+wf.link+]" title="[+wf.title+]"> 
        <img src="[+menutv+]" alt="[+wf.title+]" /> 
        <span>[+wf.linktext+]</span> 
        </a> 
        [+wf.wrapper+] 
        </li> 
        

          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
          • 26507
          • 7 Posts
          That seems like it would work perfectly, thank you so much!

          However, how can I get a rowTpl template to only affect the first-level, and have the second and subsequent ones act as they currently do now (the default settings)?
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I believe it’s outerRowTpl

            I was also thinking there might be some way to get a TV to output the resource’s menuindex, and use the TV in creating a classname.
              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