You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dick/src/public/js/open-modal.js

30 lines
884 B

// DOM Ready Function
function ready(fn) {
if (document.readyState != 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
// DOM Ready Called
ready(function () {
const buttonModal = document.getElementsByClassName('buttonModal');
const showModal = document.getElementById('showModal');
function fireModal() {
for (let index = 0; index < buttonModal.length; index++) {
buttonModal[index].addEventListener('click', () => {
if(showModal.classList.contains('flex')){
showModal.classList.remove('flex')
showModal.classList.add('hidden')
}else{
showModal.classList.remove('hidden')
showModal.classList.add('flex')
}
});
}
}
fireModal();
});