Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Amri 214 posts 740 karma points
    Mar 12, 2021 @ 13:44
    David Amri
    1

    Active CSS class in navigation

    Hi,

    I'm having difficulties getting a "active" class working in the navigation.

    I've got a property of Multinode Treepicker that let's editors pick desired content nodes for the main navigation.

    Now in the navigation template I'm using activeNode = linkNode.IsAncestorOrSelf(currentPage) ? "active" : null; in order to set a "active" CSS class of the link node. This works good if the current page is itself or a descendent of the node in the Multinode Treepicker. But if the current page is a sibling I'm having trouble geting the "active" status working.

    So in the image the "Node 2.2" is in fact a sibling of "Node 2". How can I set the "active" class on the "Node 2" if current page is "Node 2.2", a sibling.

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft