Improved modals and embedding!

This commit is contained in:
oitsjustjose 2020-02-27 22:57:16 -05:00
commit 03e6eccb71
7 changed files with 101 additions and 33 deletions

View file

@ -2,23 +2,24 @@ $(document).ready(() => {
// Close when clicking on *not* the modal-contents
window.onclick = (event) => {
if (event.target.classList.contains("modal")) {
$(event.target).slideUp(150);
event.target.style.visibility = 'hidden';
event.target.style.opacity = 0;
document.body.classList.remove("no-scroll");
}
};
document.querySelectorAll(".modal .close").forEach((closeBtn) => {
closeBtn.addEventListener('click', (evt) => {
$(closeBtn.parentElement.parentElement).slideUp(150);
// closeBtn.parentElement.parentElement.style.display = 'none';
closeBtn.parentElement.parentElement.style.visibility = 'hidden';
closeBtn.parentElement.parentElement.style.opacity = 0;
document.body.classList.remove("no-scroll");
});
});
document.querySelectorAll("[for-modal]").forEach((modalTrigerEl) => {
modalTrigerEl.addEventListener('click', (evt) => {
$(`#${modalTrigerEl.getAttribute("for-modal")}`).slideDown(150);
// document.getElementById().style.display = "block";
document.getElementById(modalTrigerEl.getAttribute("for-modal")).style.visibility = "visible";
document.getElementById(modalTrigerEl.getAttribute("for-modal")).style.opacity = 1;
document.body.classList.add("no-scroll");
});
});