We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18961 ☆ A M B ☆
    • 237 Posts
    I started this in the wrong area I believe so I moved it here.

    I was supplied code from a client that has the active state on the a instead of the li. Because of the styles, it really needs to stay on the li and not the a. I have no idea how to get Wayfinder to put the active state on the link instead of the li.

    Does anyone know how to do this?

    Would really appreciate some help.

    Thanks! [ed. note: mdsdesign last edited this post 14 years, 4 months ago.]
      Michael Smull
      http://www.bigpixelstudio.com
      twitter: @mdsdesign
      • 34030 ☆ A M B ☆
      • 23 Posts
      Hi,

      In my experience, Wayfinder will do this by default. If it’s not, you might be using an alternative template for parentRowHereTpl or activeParentRowTpl.

      Can you check to see if either of these things are defined in your Wayfinder call — then trace them back to the chunk defined.
        • 19369
        • 1,098 Posts
        How is your Wayfinder Call?
        Here is an example of how you can apply the active class to the link:

        Wayfinder call:
        [[Wayfinder? &startId=`0` &rowTpl=`rowTPL`]]

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

        Basically you need to move [ [+wf.classes] ] from the "a" tag to the "li" tag, so your rowTPL change in this way:
        <li[[+wf.classes]]><a href="[[+wf.link]]">[[+wf.linktext]]</a>[[+wf.wrapper]]</li>
          • 18961 ☆ A M B ☆
          • 237 Posts
          I probably should have put the code in from the beginning. Sorry about that. Here is what I'm using for the call:

          [[Wayfinder?startId=`0` &outerTpl=`topnav`]]


          And here is my template:

          <ul id="MainNav"[+wf.classes+]>[+wf.wrapper+]</ul>


          This is just what I've always used but now I have provided html/css that is setup differently than I would do it.
            Michael Smull
            http://www.bigpixelstudio.com
            twitter: @mdsdesign
            • 18961 ☆ A M B ☆
            • 237 Posts
            Thanks microcipcip. Your logic helped me figure it out. It just took a few minutes to think it through.
              Michael Smull
              http://www.bigpixelstudio.com
              twitter: @mdsdesign
              • 19369
              • 1,098 Posts
              Strange, Wayfinder by default should apply the "active" class to the "li" tag when &rowTpl parameter is not configured.