2
I want to make a menu to some extent simple with CSS3 and Javascript. My menu needs to have a "hamburger" and when you click you need to turn an "X". When you click on a link it also needs to close and the "X" turn the "hamburger" again.
Follow down what I already have.
$(document).ready(function(){
$('nav a').on('click', function(){
$('#menu').prop('checked', false);
});
});
*{ margin:0; box-sizing: border-box; overflow: hidden }
nav {
border: 1px solid #333;
display: flex;
flex-flow: column wrap;
right: -100%;
transition: right 400ms ease-in;
position: absolute;
width: 100%;
height:100%;
background:rgba(0,0,0,8);
opacity: 0.5;
line-height: 30px;
}
nav a{
text-decoration: none;
text-align: center;
font-size: 40px;
margin:3% 0%;
color:#fff;
font-family:sans-serif;
}
nav.open{
right: 0;
transition: right 400ms ease-in;
}
nav a:hover{
color:yellow;
}
label { display: block; padding:10px 10px 0px; text-align:left; }
#menu{display: none;
}
#menu:checked + nav {
right: 0;
}
<label for='menu'>MENU</label>
<input id='menu' type='checkbox'/>
<nav>
<a href='#!'>LINK 1</a>
<a href='#!'>LINK 2</a>
<a href='#!'>LINK 3</a>
<a href='#!'>LINK 4</a>
<nav>
great! but try to incorporate this into my code and with my Nav
– Tiago P.C
@Tiagop. C I answered only your question, I believe it is not so complicated to incorporate into your project. i created one that I believe is much nicer haha http://jsfiddle.net/filadown/zreqjw39/
– Gabriel Rodrigues