14 lines
313 B
JavaScript
14 lines
313 B
JavaScript
const panels = document.querySelectorAll('.panel')
|
|
|
|
panels.forEach(panel => {
|
|
panel.addEventListener('click', () => {
|
|
removeActiveClasses()
|
|
panel.classList.add('active')
|
|
})
|
|
})
|
|
|
|
function removeActiveClasses() {
|
|
panels.forEach(panel => {
|
|
panel.classList.remove('active')
|
|
})
|
|
} |