You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
457 B
JavaScript

var modal = document.querySelector('[data-modal]');
modal.addEventListener('click', function (event) {
event.preventDefault();
var modalId = document.getElementById(modal.dataset.modal);
modalId.classList.add('open');
var exits = modalId.querySelectorAll('.modal-exit');
exits.forEach(function (exit) {
exit.addEventListener('click', function (event) {
event.preventDefault();
modalId.classList.remove('open');
});
});
});