Hi Everyone,
I am creating my main menu using the navigation sets and was wondering if there is a token to get the current navigation item when that item page is loaded or viewed. What I mean is if homepage is loaded add a CSS class to home menu item. Similarly if any other category or page is loaded add the CSS class to that menu item.
I have listed a simple example of what I trying to achieve.
As you can see when I am homepage, I am trying to add dynamically a CSS class called current-menu.
Thanks
I am creating my main menu using the navigation sets and was wondering if there is a token to get the current navigation item when that item page is loaded or viewed. What I mean is if homepage is loaded add a CSS class to home menu item. Similarly if any other category or page is loaded add the CSS class to that menu item.
I have listed a simple example of what I trying to achieve.
HTML Code:
<ul id="main-menu" class="menu-container"> <li class="c-navigation__list current-menu"><a href=/SFNT.html">Home</a></li> <li class="c-navigation__list"><a href=/PLST.html">Shop All</a></li> <li class="c-navigation__list has-child-menu"><a href=/Some-Parent.html">Parent Category</a> <ul class="sub-menu">.....</ul> </li> </ul>
Thanks
Comment