I implemented a hamburger menu that slides in when clicked. However, I'm facing an issue where the slide-in menu disappears after a second. How can I make sure the menu stays visible?
#navigationWrap {
position: fixed;
top: 0;
left: -1000px; /* left: 0; */
width: 710px;
height: 100vh;
background: grey;
*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body{
background: #FCF7F0;
}
header{
display: flex;
width: 90%;
margin: auto;
height: 10vh;
}
.navbar{
flex: 1;
text-align: left;
padding-top: 60px;
color: black;
cursor: pointer;
}
.close{
flex: 1;
/* background: lightsalmon; */
text-align: right;
padding-top: 60px;
color: black;
}
.fa {
font-size: 68px !important; /*size of fa icons*/
}
.presentation{
display: flex;
margin: auto;
}
#navigationWrap {
position: fixed;
top: 0;
left: -1000px; /* left: 0; */
width: 710px;
height: 100vh;
background: grey;
transition: .5s;
padding: 20px;
text-align: center;
box-sizing: border-box;
z-index: 10;
}
.navbar:active ~ #navigationWrap {
left: 0;
transition: .1s;
}
.close_container{
display: block;
text-align: left;
position: absolute;
top: 60px;
left: 60px;
color: white;
z-index: 15;
cursor: pointer;
}
.nav-links{
justify-content: space-around;
list-style: none;
padding: 150px 0px 100px 0px;
}
.nav-link{
text-decoration: none;
color: white;
font-size: 50px;
line-height: 80pt;
}
<head>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
<header>
<div class="navbar" title="menu">
<i class="fa fa-bars" aria-hidden="true"></i>
</div>
<div class="close">
<i class="fa fa-times" aria-hidden="true"></i>
</div>
<div id="navigationWrap" class="navigationWrap">
<div class="container">
<div class="close_container">
<i class="fa fa-times" aria-hidden="true"></i>
</div>
<nav>
<ul class="nav-links">
<li><a href="#" class="nav-link">Home</a></li>
<li><a href="#" class="nav-link">Services</a></li>
<li><a href="#" class="nav-link">About</a></li>
<li><a href="#" class="nav-link">Contact</a></li>
</ul>
</nav>
</div>
</div>
</header>
<main>
<section class="presentation">
</section>
</main>
</body>
transition: .5s;
padding: 20px;
text-align: center;
box-sizing: border-box;
z-index: 10;
}
.navbar:active ~ #navigationWrap {
left: 0;
transition: .1s;
}
Could someone assist me in resolving this issue? Any help would be greatly appreciated.