Here is my working solution:
//gives command on click to close the menu and go to the anchor link location
jQuery('.menu_mobile ul li a').click(function(){
jQuery("div.menu_mobile ul").css('display' , 'none');
jQuery("div.menu_mobile ul"). removeClass('nav menu mod-list');
//reloads the page without loosing the anchor link location
jQuery(".mobile-menu").click(function() { location.reload()
});
});
I have this small Joomla project and I need help with the mobile menu. The anchor links just scroll but the menu doesn’t close. Is there any script I can add to the index.php?
Those are my menu classes:
<div class="menu_mobile">
<ul class="nav menu mod-list">
<li class="items">
<ul class="nav-child unstyled" style="display: block;">
<li class="item-1"><a href="/anchor-link#link1">anchor link 1</a></li>
<li class="item-2"><a href="/anchor-link#link2">anchor link 2</a></li>
<li class="item-3"><a href="/anchor-link#link3">anchor link 3</a></li>
<li class="item-4"><a href="/anchor-link#link4">anchor link 4</a></li>
<li class="item-5"><a href="/anchor-link#link5">anchor link 5</a></li>
<li class="item-6"><a href="/anchor-link#link6">anchor link 6</a></li>
</ul>
</li>
</ul>
</div>
Thank you in advance.