I have a navigation (selfmade HTML, no CMS).
Code:
<ul id="navmenu" class="open">
<li><a href="/" class="nav-home"><i class="menu-icon icon-home"></i></a></li>
<li><a href="#" data-filter="one"><i class="menu-icon icon-one"></i><span>One</span></a></li>
<li><a href="#" data-filter="two"><i class="menu-icon icon-two"></i><span>Two</span></a></li>
<li><a href="#" data-filter="three"><i class="menu-icon icon-three"></i><span>Three</span></a></li>
<li><a href="#" data-filter="four"><i class="menu-icon icon-four"></i><span>Four</span></a></li>
</ul>
Now I want to realize a "current" state.
Example:
If page "ONE" is loaded, the icon span text should be displayed right besides the Icon (normal state: display:none;
)
When a Page is loaded the sitename is in the body-tag like:
<body class="site one">
I need to figure out which site or which class is added in the body tag and display the "state" in the navigation.
Pseudo Code:
If "class" is in body >
search for "class" in navigation (search for data-"class" attribute)>
and display span / set class "active"
Can you push me in the right direction? Thank you!