odin-css-exercises/animation/03-pop-up/script.js
2021-10-20 23:05:31 +01:00

12 lines
452 B
JavaScript

const openButton = document.getElementById('trigger-modal');
const closeButton = document.getElementById('close-modal');
function toggleModal() {
const container = document.querySelector('.button-container');
const modalDiv = document.querySelector('.popup-modal');
modalDiv.classList.toggle('show');
container.classList.toggle('show');
}
openButton.addEventListener('click', toggleModal);
closeButton.addEventListener('click', toggleModal);