Content update
- Adds in some missing speakers - Under construction meetups - Fixes links in media descriptions - Adds hover indicators to img_grid - Adds esc key in modals
This commit is contained in:
@@ -36,7 +36,12 @@
|
||||
|
||||
|
||||
// modals
|
||||
// openers
|
||||
function toggle_modal(target, show) {
|
||||
target.classList.toggle("hidden", !show);
|
||||
body.classList.toggle("overflow-hidden", show);
|
||||
body.setAttribute("modal", show ? target.id : "");
|
||||
}
|
||||
|
||||
const body = document.querySelector("body");
|
||||
const show_modal_buttons = document.querySelectorAll("[data-modal-show]");
|
||||
show_modal_buttons.forEach((btn) => {
|
||||
@@ -44,8 +49,7 @@
|
||||
const modal = document.querySelector(`#${target}`);
|
||||
if (modal) {
|
||||
btn.addEventListener("click", (e) => {
|
||||
modal.classList.toggle("hidden", false);
|
||||
body.classList.toggle("overflow-hidden", true);
|
||||
toggle_modal(modal, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -56,8 +60,7 @@
|
||||
const modal = document.querySelector(`#${target}`);
|
||||
if (modal) {
|
||||
btn.addEventListener("click", (e) => {
|
||||
modal.classList.toggle("hidden", true);
|
||||
body.classList.toggle("overflow-hidden", false);
|
||||
toggle_modal(modal, false);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -65,13 +68,19 @@
|
||||
const modal_bg = document.querySelectorAll(".modal-bg");
|
||||
modal_bg.forEach((bg) => {
|
||||
bg.addEventListener("click", (e) => {
|
||||
if(e.target === bg) {
|
||||
bg.classList.toggle("hidden", true);
|
||||
body.classList.toggle("overflow-hidden", false);
|
||||
if (e.target === bg) {
|
||||
toggle_modal(bg, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape") {
|
||||
var modal_id = body.getAttribute("modal");
|
||||
if(modal_id) toggle_modal(document.querySelector(`#${modal_id}`), false);
|
||||
}
|
||||
});
|
||||
|
||||
// Swipers
|
||||
// ----------------------------------------
|
||||
const swipers = document.querySelectorAll(".swiper-slider");
|
||||
@@ -100,3 +109,5 @@
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
// c > js -devon
|
||||
Reference in New Issue
Block a user