Hello everyone, I have a menu for mobile "hamburger" and I want it to close when I press some menu link.
Menu HTML code:
<div class="menu">
<button class="hamburger">
<img src="images/responsive/cel_retrato/ham.png"/>
</button>
<button class="cross">˟</button>
<ul clas="menuMM">
<a href="#topo"><li>HOME</li></a>
<a href="#pixel"><li>SOBRE</li></a>
<a href="#servicos"><li>SERVIÇOS</li></a>
<a href="#projetos"><li>PORTFÓLIO</li></a>
<a href="#contactM"><li>CONTATO</li></a>
</ul>
</div>
JavaScript code:
$( ".cross" ).hide();
$( ".menu" ).hide();
$( ".hamburger" ).click(function() {
$( ".menu" ).slideToggle( "slow", function() {
$( ".hamburger" ).hide();
$( ".cross" ).show();
});
});
$( ".cross" ).click(function() {
$( ".menu" ).slideToggle( "slow", function() {
$( ".cross" ).hide();
$( ".hamburger" ).show();
});
});
To close the menu I am using this logic, but it is not working.
$( ".menuMM" ).click(function() {
$( ".menu" ).slideToggle( "slow", function() {
$( ".cross" ).hide();
$( ".hamburger" ).show();
});
});