앞장에 이어서
.icon {
background-color: #fff;
border: 0;
cursor: pointer;
padding: 0;
position: relative;
height: 30px;
width: 30px;
}
.icon:focus {
outline: 0;
}
.icon .line {
background-color: #5290f9;
height: 2px;
width: 20px;
position: absolute;
top: 10px;
left: 5px;
transition: transform 0.6s linear;
}
.icon .line2 {
top: auto;
bottom: 10px;
}
nav.active .icon .line1 {
transform: rotate(-765deg) translateY(5.5px);
}
nav.active .icon .line2 {
transform: rotate(765deg) translateY(-5.5px);
}
// 아이디 toggle 객체, nav 객체 저장
const toggle = ?;
const nav = ?;
//토글 X 를 클릭하면 nav 객체에 'active'클래스를 토글
toggle.addEventListener('click', () => nav.classList. ? ('active'));