restore modal animation on desktop

This commit is contained in:
marlon-erler
2026-04-01 08:46:10 +00:00
parent fd8aafed6d
commit 551d2c3aba
7 changed files with 9267 additions and 7190 deletions
+23 -20
View File
@@ -1,32 +1,35 @@
// TABS
document.querySelector("main").addEventListener("scroll", () => {
const links = document.querySelectorAll(".tab-link");
links.forEach((element) => element.removeAttribute("active"));
const links = document.querySelectorAll(".tab-link");
links.forEach((element) => element.removeAttribute("active"));
const pageWidth = document.querySelector("main > article").offsetWidth;
const scroll = document.querySelector("main").scrollLeft;
const currentPage = Math.round(scroll / pageWidth);
const pageWidth = document.querySelector("main > article").offsetWidth;
const scroll = document.querySelector("main").scrollLeft;
const currentPage = Math.round(scroll / pageWidth);
if (links[currentPage]) links[currentPage].setAttribute("active", "");
if (links[currentPage]) links[currentPage].setAttribute("active", "");
});
// SERVICE WORKER
async function registerServiceWorker() {
if ("serviceWorker" in navigator) {
try {
const registration = await navigator.serviceWorker.register("/sw.js", {
scope: "/",
});
if (registration.installing) {
setTimeout(() => window.location.reload(), 500);
} else if (registration.active) {
console.log("Service worker active");
registration.update();
}
} catch (error) {
console.error(`Could not install service worker: ${error}`);
if ("serviceWorker" in navigator) {
try {
const registration = await navigator.serviceWorker.register(
"/sw.js",
{
scope: "/",
},
);
if (registration.installing) {
setTimeout(() => window.location.reload(), 500);
} else if (registration.active) {
console.log("Service worker active");
registration.update();
}
} catch (error) {
console.error(`Could not install service worker: ${error}`);
}
}
}
}
registerServiceWorker();