Help Js. Toggel class do not work

Continuing the discussion from Landin page feedback:

Hi. I have fixed that issue with responsiveness. But I have now another issue… Maybe somebody can take a look? In the small screen size I get ugly scroll bar, but when I hit the bottom of the page thats fixes itself. I cant find out what I am doing wrong.
And the second issue is that the hamburger menu is actually not toggeling. It dont close the menu…
Please any suggestion why this might heppening?
https://codepen.io/at-web/full/BaNxmmL

Your first issue is that nav goes outside of whole section on smaller screen, that’s why its adding you’r scrollbar at the bottom, you can add overflow-x: hidden; to the body and that should fix your first issue, and the second thing works, you can toggle the menu, but its depending on where u click so probably because of way its made im guessing beause of before and after, doesn’t do anything if you click on empty space between lines.

Thanks!
I added overflow-x: hidden, but seems thats not fixed the issue…

`const menuBtn = document.getElementById(‘menuBtn’);
const menu = document.getElementById(‘menu’);
const menuItem = document.querySelectorAll(‘li[a]’);

menuBtn.addEventListener(‘click’, function(e) {
e.preventDefault();
menu.classList.toggle(‘open’)
})

menuBtn.addEventListener(‘click’, function(e) {
e.preventDefault();
this.classList.toggle(‘active’)
})

window.addEventListener(‘mouseup’, e => {
if(e.target != menu && e.target.parentNode != menu) {
menu.classList.remove(‘open’);
};
});

window.addEventListener(‘mouseup’, e => {
if(e.target != menu && e.target.parentNode != menu) {
menuBtn.classList.remove(‘active’)
};
});`

Did u add overflow to body? That worked for me when i did it in your codepen. In case it was bugged and it doesnt work, let me know and ill just get the code on my pc and figure it out there

Yes added overflow-x: hidden to body. And now I get this…


I cant figur it out what is the probleem…