Answer the question
In order to leave comments, you need to log in
Throws an error when I run the code through webpack?
I can't figure out what's wrong.
When I run the code through webpack, the output in the browser console gives an error
Swears at this piece of code.
burger.addEventListener( `click`, () => {
burger.classList.toggle( `burger--active` );
headerBottom.classList.toggle( `scroll` );
});
const burgerElem = burger.classList.contains( `burger--active` );
if ( !burgerElem ) {
burger.addEventListener( `click`, () => {
document.querySelectorAll( `.open` ).forEach( item => {
item.classList.remove( `open` );
});
document.querySelectorAll( `.sub-nav` ).forEach( item => {
item.style.display = `none`;
});
});
}
Answer the question
In order to leave comments, you need to log in
webpack has nothing to do with it, based on the error, you are trying to hang an event handler on a variable that is null
Where does the burger variable come from?
I understood what was the mistake, I did not transfer the html files to the collector.
Accordingly, he did not find them and gave an error
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question