mirror of
https://github.com/Theodor-Springmann-Stiftung/jacoblenz.git
synced 2026-03-21 06:45:30 +00:00
+3 verzichnisse, Biographische Landkarten
This commit is contained in:
23
docs/static/js/scripts.js
vendored
23
docs/static/js/scripts.js
vendored
@@ -193,6 +193,25 @@ const toggleghidecat = function(cat) {
|
||||
}
|
||||
}
|
||||
|
||||
const initHoverSwap = function () {
|
||||
const imgs = document.querySelectorAll("img[data-hover]");
|
||||
for (let img of imgs) {
|
||||
if (!img.dataset.src) {
|
||||
img.dataset.src = img.getAttribute("src");
|
||||
}
|
||||
const showHover = function () {
|
||||
img.setAttribute("src", img.dataset.hover);
|
||||
};
|
||||
const showOriginal = function () {
|
||||
img.setAttribute("src", img.dataset.src);
|
||||
};
|
||||
img.addEventListener("mouseenter", showHover);
|
||||
img.addEventListener("mouseleave", showOriginal);
|
||||
img.addEventListener("touchstart", showHover, { passive: true });
|
||||
img.addEventListener("touchend", showOriginal);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Mobile menu
|
||||
if (navbtnelement !== null && navelelement !== null) {
|
||||
@@ -205,6 +224,10 @@ if (navbtnelement !== null && navelelement !== null) {
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
initHoverSwap();
|
||||
});
|
||||
|
||||
// Hide category button
|
||||
for (let el of hideprevsiblingbtnelements) {
|
||||
el.addEventListener("click", () => {
|
||||
|
||||
Reference in New Issue
Block a user