I'm using Foundation's Responsive Navigation to display a Hamburger icon for mobile. For the life of me, I cannot figure out how to apply a class to the body element when the mobile menu is displayed (after the Hamburger icon is clicked)
Can someone tell me what I'm doing wrong? Currently, the only thing that happens when toggling the Hamburger is the style attribute "display: none" is toggled on the .mobile-nav div. I know there's nothing wrong with the JavaScript set up outside of this issue, as I'm able to see other console.log() statements.
<a href="#" class="burger" data-toggle>-</a>
<div class="mobile-nav" id="mobile-nav">
<ul class="vertical menu" data-responsive-menu="drilldown medium-dropdown">
<li><a href="#">Link 1</li>
<li><a href="#">Link 2</li>
</ul>
</div>
Here's what I've tried, but nothing ever appears in the console:
$('[data-responsive-toggle]').on('toggled.zf.responsiveNavigation', function () {
console.log('responsive navigation toggled');
});
$('.mobile-nav').on('toggled.zf.responsiveNavigation', function () {
console.log('responsive navigation toggled');
});
$('#mobile-nav').on('toggled.zf.responsiveNavigation', function () {
console.log('responsive navigation toggled');
});