I'm using an Accordion menu instead of an Off-canvas solution below the medium breakpoint, as described in the Foundation Docs here, but I'm struggling to have the menu auto-closed after a link within the menu is clicked. I searched for a solution and have seen this question around but did not find an answer that worked for me. But i came across this example, and upon examination i thought simply substituting .off-canvas
with the class used by the vertical menu would do the trick, but that's not the case.
$(document).foundation();
$('.vertical a').on('click', function() {
$('.vertical').foundation('close');
});
My menu markup:
<nav class="vertical menu" id="mobile-menu" role="navigation">
<ul id="menu-main-1" class="vertical menu" data-accordion-menu="8k34n8-accordion-menu" role="tablist" aria-multiselectable="true">
<li class="menu-item" role="menuitem"><a>Link 1</a></li>
<li class="menu-item" role="menuitem"><a>Link 2</a></li>
<li class="menu-item" role="menuitem"><a>Link 3</a></li>
</ul>
</nav>
I'm new to this so please excuse if the answer is obvious. I hope for someone to point me in the right direction here so i learn something.