I'm trying to make a menu similar to this:
Click here to see the menu example
What I did, I put a div
over the other using position:absolute
and hid the div
responsible for the menu with a display:none
and in JS I'm trying to apply an effect that causes it to be displayed when clicked button, just like the site example. However, to no avail.
It does not necessarily have to be with JS. It can be with JS, JQuery, CSS3 (I believe this can be done with it too) etc.
Anyway, is there a "better way" to do this? Where am I going wrong?
function exibe(){
document.getElementById('nav').body= ??
}
html, body{
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#principal{
position: absolute;
width: 100%;
height: 100%;
}
#nav{
display: none;
position: absolute;
height: 100%;
z-index: 10;
}
#menu{
z-index: 11;
position: absolute;
}
<div id="principal">
<button id="menu" onclick="exibe()"> MENU </button>
<img src="http://i.stack.imgur.com/fr1br.png"style="width:100%; height:100%">
</div>
<div id="nav">
<img src="http://i.stack.imgur.com/UQXbV.png"style="height:100%">
</div>