Проблема состоит в том что вручную active добавляется и код работает, а js прописываю и никакой реакции и ошибку не могу найти
let burger = document.querySelector(".dribble__burger");
burger.addEventListener(`click`, function() {
burger.classList.toggle(`active`);
})
.dribble__burger {
position: relative;
width: 30px;
height: 30px;
z-index: 2;
}
.dribble__burger span {
position: absolute;
width: 30px;
height: 2px;
background-color: #9e9ea7;
left: 50%;
top: 50%;
}
.dribble__burger span:nth-last-of-type(2) {
top: calc(50% - 5px);
}
.dribble__burger span:nth-last-of-type(3) {
top: calc(50% + 5px);
}
@media(max-width:915px) {
.drible__ul {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
padding: 15px;
flex-direction: column;
transform: translateX(-100%);
background-color: green;
}
.dribble__burger.active span:first-of-type{
opacity: 0;
}
.dribble__burger.active span:nth-of-type(2) {
top: 50%;
transform: translate(-50%, -50%) rotate(45deg);
}
.dribble__burger.active span:nth-of-type(3) {
top: 50%;
transform: translate(-50%, -50%) rotate(-45deg);
}
}
<div class="dribble__burger">
<span></span>
<span></span>
<span></span>
</div>