odin-css-exercises/animation/03-pop-up/script.js

13 lines
452 B
JavaScript
Raw Normal View History

2021-10-20 15:05:31 -07:00
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);