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

13 lines
452 B
JavaScript
Raw 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 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);