I use the framework CSS Materialize, but I have a problem. How can I close the left-mobile-menu when I click in a link ? By default the menu closes only when you click outside the menu. So I tried with the fonction removeMenu() but it doesn't work. Anyone has a solution ? This is my menu :
<div class="navbar-fixed">
<nav class="orange darken-4" role="navigation">
<div class="nav-wrapper container">
<a id="logo-container" class="brand-logo"><img id="class" src="img/logo.png" class="nav_logo"></a>
<ul class="right hide-on-med-and-down">
<li><a>test</a></li>
<li ><a>test2</a></li>
</ul>
<ul id="nav-mobile" class="side-nav">
<li><a>test</a></li>
<li><a>test2</a></li>
</ul>
<a href="#" data-activates="nav-mobile" class="button-collapse" id="burger_menu"><i class="material-icons">menu</i></a>
</div>
</nav>
</div>
Add closeOnClick
// Initialize collapse button
$('.button-collapse').sideNav({
menuWidth: 300, // Default is 240
edge: 'left', // Choose the horizontal origin
closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With