<div class="container">
<h1>this is the navbar</h1>
<a href="#" class="menu-btn">
<span class="material-symbols-outlined ">
menu
</span>
</a>
<ul class="navbar">
<li>section1</li>
<li>section2</li>
<li>section3</li>
</ul>
</div>
.container {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 500px;
margin: 0 auto;
border: 1px solid #000;
margin-top: 5px;
padding: 5px;
position: relative;
}
a {
color: #000;
}
li {
border: 1px solid #000;
}
.navbar{
text-align: center;
width: 100%;
max-height: 0%;
position: absolute;
bottom: 0;
left: 0;
z-index: 10;
transform: translateY(100%);
overflow: hidden;
transition: max-height 0.7s;
background: $navbar__color;
}
.navbar.show{
max-height: 500px;
}
$(document).ready(function(){
$('.menu-btn').click(function (e) {
e.preventDefault();
$('.navbar').toggleClass('show');
});
})
This Pen doesn't use any external CSS resources.