I adapted an online navbar implementation which collapses and expands on mobile, and now I would like to animate the navbar opening and closing.
Here's the HTML:
And here's the existing relevant CSS:
Here's the HTML:
HTML:
<nav>
<div id="nav-wrapper">
<button class="icon" onclick="menuBar()"><i class="gg-menu-right"></i></button>
<button onclick="darkMode()"><i class="gg-dark-mode"></i></button>
<a href="/pages/index.html">Winston Purnomo</a>
<a href="/pages/portfolio.html">Portfolio</a>
<a href="/pages/contact.html">Contact</a>
</div>
</nav>`
And here's the existing relevant CSS:
CSS:
/* -- Navigation Bar. -- */
nav {
overflow: hidden;
position: sticky;
top: 0px;
background-color: #333;
padding: 20px 20px;
font-size: var(--nav-text);
}
....
@media screen and (max-width: 600px) {
....
nav.responsive {
position: relative;
}
nav.responsive .icon {
position: sticky;
right: 0;
top: 0;
}
nav.responsive a {
float: none;
display: block;
text-align: left;
}
}