50projects50days/expanding-cards/script.js

14 lines
313 B
JavaScript
Raw Normal View History

2020-10-12 16:11:30 +00:00
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')
})
}