adding .current to nav?
This is an open discussion with 4 replies, filed under General.
Search
That code already has one, the class is just active
, instead of current
.
If you want it on the li
, you'll want to use this code:
<li> <xsl:if test="@handle = $root-page"> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <a href="{$root}/{@handle}/"><xsl:value-of select="name"/></a> </li>
The xsl:attribute name="class"
is what you want to look at here.
hmm that did not work.
<a href="{$root}/{@handle}/"> <!-- If the handle matches the root page, give our anchor a class of 'active' --> <xsl:if test="@handle = $root-page"> <xsl:attribute name="class">active</xsl:attribute> </xsl:if> <!-- Print the page's name --> <xsl:value-of select="name"/> </a> </li>
you were right, it was already in the nav.xsl. oh well. Thanks!
Create an account or sign in to comment.
bah, hey folks.
I have this xsl
I want to add a .current class to the nav. I was thinking I could use addClass jquery. But I want to know how I would use and xsl if statement?
I just don't know what to test for, of the current page.. I mean if I do $current-page it adds the class still to all li's