Need help in resolving an issue with hamburger

I am creating a portfolio as part of FCC project. I have put a hamburger menu for mobile devices. But it works only when I click for the first time. After that, I am not able to trigger the onclick events over the hamburger. Could anyone please have a look and help me out what am I doing wrong or missing. Below is the codepen link of the page:

Portfolio

Hi your code is not working because you didn’t add an event listener try this

var nav = document.querySelector('.nav');
nav.addEventListener('click',clickBtn)

function clickBtn(){
    
    nav.classList.toggle('nav--visible')
};
1 Like

Hi @MculoFish, Thanks for going over my code and trying to help…!! Your code did work…But I had added the event handler on the hamburger’s button’s onclick event in html markup already… Is that not enough… Am curious…Thanks alot for helping out…!!

1 Like

Im not sure why your internal javascript isnt working I’ve never used it but id recommend you use an external file to write your javascript so you wont get confused

1 Like

Sure @MculoFish…!! Thanks alot again…!!