How do I make the menu button open the nav menu in media queries
Hi I am trying to make a menu button for a responsive website and somehow my javascript is not working. The button is at the right place but when I click it, nothing shows up.
any help would be appreciated!
I linked the javascript file by
html
Name
css
/* Media queries for responsiveness */
@media screen and (max-width: 800px){
body{
grid-template-columns: 1fr;
grid-template-areas:
"logo"
"sidebar"
"main"
"footer";
}
nav{
position: fixed;
width: 300px;
display: none;
}
.show{
display: block;
}
javascript
const sidebar = document.getElementById('sidebar')
function toggleSidebar(){
sidebar.classList.toggle('show')
}