I'm using mmenu to create a menu. While I'm open to advice on whether to use jquery or PHP (best practice advice), I need to be able to easily include my menu on each new page. I hope this makes updates easier.
The problem is that mmenu does not seem to automatically activate the active li on page load. Once a link to a new page is clicked, the li appears selected, but once the new page loads and the scripts start over and I arrive at the main menu. The issue might be further complicated by the fact that I have submenus.
I have tried using the 3rd party "currentitem" addon for mmenu with no success.
This is a simplified menu example.
<nav id="menu">
<li>
<ul>
<li><a href="/root/page1.html">page1</a></li>
<li>
<ul>
<li><a href="/root/page2.html">page2</a></li>
<li><a href="/root/page3.html">page3</a></li>
</ul>
</li>
</ul>
</ul>
</nav>
You need to add the class 'mm-selected' to the parent li tag for the active href, this will make your menu open at the correct position.
I hope this helps.
Derek