Das ist meine current project auf CodePen.Below ist mein Code. Tut mir leid, wenn es zu lang ist. Ich habe versucht, es kurz zu machen, indem ich die Animation nicht hinzugefügt habe.Warum erscheint mein Einzugsmenü nicht?
Der Wunsch-Effekt ist, wenn Sie auf das Menüsymbol klicken, wird die erste Navigationsleiste eingeblendet und der zweite mit einem Kreuzsymbol wird eingeblendet. Aber ich weiß nicht wo meine zweite Navigationsleiste ist, sie erscheint nicht.
//This function retracts the menu bar with the menu icon and expand the menu bar with close icon.
function open(){
document.getElementById("openNav").style.width = "0px";
document.getElementById("closeNav").style.width = "20%";
}
//This thing does the opposite of the above function
function close(){
document.getElementById("openNav").style.width = "20%";
document.getElementById("closeNav").style.width = "0px";
}
*{
padding:0;
margin:0;
}
html, body{
height:100%;
width:100%;
}
/*First nav bar of the two. You press the menu icon, this bar slides in and the second nav bar slides out.*/
.openNav{
height:100%;
width:20%;
background:#111;
}
.openBox{
width:100%;
box-sizing:border-box;
padding:calc((100% - 50px)/2);
position:relative;
bottom:15px;
}
.open{
font-size:50px;
color: #818181;
}
/*Second nav bar with a close button. You press the close button, the bar slides in and the first nav bar slides out.*/
.closeNav{
height:100%;
width:20%;
background:#111;
}
.closeBox{
width:100%;
box-sizing:border-box;
padding:calc((100% - 50px)/2);
position:relative;
bottom:15px;
}
.close{
font-size:50px;
color: #818181;
}
<div class='openNav' id='openNav'>
<div class='openBox'>
<div class='open' onclick='open()'>☰</div>
</div>
</div>
<div class='closeNav' id='closeNav'>
<div class='closeBox'>
<div class='close' onclick='close()'>×</div>
</div>
</div>
die zweite nav bar ist am unteren Rand? – AirNoir