deguapp/frontend-plain/js/modal.js
2023-12-13 19:10:39 +01:00

15 lines
362 B
JavaScript

// close on button
const close = qSA(".md-close")
close.forEach(one => {
one.addEventListener("click", (el) => {
qS(".md-active").classList.remove("md-active")
})
})
// close on backdrop
window.onclick = function(event) {
const active = qS(".md-active")
if (event.target == active) {
active.classList.remove("md-active")
}
}