odin-default-css-exercises/animation/02-pop-up/script.js

12 lines
441 B
JavaScript
Raw Permalink Normal View History

2021-10-20 22:05:31 +00:00
const openButton = document.getElementById('trigger-modal');
const closeButton = document.getElementById('close-modal');
function toggleModal() {
const modalDiv = document.querySelector('.popup-modal');
const backdrop = document.querySelector('.backdrop');
2021-10-20 22:05:31 +00:00
modalDiv.classList.toggle('show');
2022-01-12 20:38:29 +00:00
backdrop.classList.toggle('show');
2021-10-20 22:05:31 +00:00
}
openButton.addEventListener('click', toggleModal);
closeButton.addEventListener('click', toggleModal);