Modal and such!
This commit is contained in:
parent
0a757dd500
commit
e40807b623
7 changed files with 95 additions and 26 deletions
|
|
@ -42,10 +42,8 @@ const toggleMenu = () => {
|
|||
|
||||
if (visible) {
|
||||
document.body.classList.add("no-scroll");
|
||||
console.log("not visible");
|
||||
} else {
|
||||
document.body.classList.remove("no-scroll");
|
||||
console.log("visible");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
$(document).ready(() => {
|
||||
// Close when clicking on *not* the modal-contents
|
||||
window.onclick = (event) => {
|
||||
if (event.target.classList.contains("modal")) {
|
||||
$(event.target).slideUp(150);
|
||||
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';
|
||||
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.body.classList.add("no-scroll");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in a new issue