12 lines
No EOL
441 B
JavaScript
12 lines
No EOL
441 B
JavaScript
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');
|
|
modalDiv.classList.toggle('show');
|
|
backdrop.classList.toggle('show');
|
|
}
|
|
|
|
openButton.addEventListener('click', toggleModal);
|
|
closeButton.addEventListener('click', toggleModal); |