diff --git a/public/custom/tiefenflug.css b/public/custom/tiefenflug.css index eb49055..06d56af 100644 --- a/public/custom/tiefenflug.css +++ b/public/custom/tiefenflug.css @@ -235,6 +235,10 @@ .kein-js .flug-strecke, .ohne-intro .flug-strecke { display: none; } +/* Intro vorbei: Bühne räumen, damit die echte Seite darunter voll scrollbar + ist und der Dock wieder auftauchen kann. */ +.intro-beendet .flug-strecke { display: none; } + @media (prefers-reduced-motion: reduce) { .flug-foto img, .flug-hinweis, .preis-text, .preis-text .rieseln { animation: none; } diff --git a/public/custom/tiefenflug.js b/public/custom/tiefenflug.js index 373ca27..d534321 100644 --- a/public/custom/tiefenflug.js +++ b/public/custom/tiefenflug.js @@ -17,6 +17,7 @@ // Reduzierte Bewegung: Intro überspringen, normale Seite direkt zeigen if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { document.documentElement.classList.add('ohne-intro'); + document.documentElement.classList.add('intro-beendet'); return; } @@ -59,7 +60,7 @@ var SINKFLUG = 190; // px Sinkflug am Ende var GEIST_FENSTER = [[0.08, 0.25], [0.25, 0.42], [0.42, 0.60]]; - var eingerastet = false; // Feature: einmal durch = kein Rückflug bis zum Neuladen + var eingerastet = false; // Feature: einmal durch = Intro aus, normale Seite übernehmen var konfettiAb = false; var mausX = 0, mausY = 0; @@ -181,13 +182,15 @@ window.addEventListener('scroll', function () { var max = maxScroll(); - // Einrasten: Wer den Flug beendet hat, kommt höchstens bis zum - // Preis-Moment zurück – der Flug startet erst beim Neuladen wieder. - if (!eingerastet && window.scrollY >= max) eingerastet = true; - if (eingerastet && window.scrollY < max) { - window.scrollTo(0, max); + // Intro zu Ende: Bühne wird per CSS deaktiviert (.intro-beendet), + // die echte Seite darunter ist ab dann voll scrollbar. Den Scroll- + // Handler nicht mehrfach anstoßen – das Intro läuft genau einmal. + if (!eingerastet && window.scrollY >= max) { + eingerastet = true; + document.documentElement.classList.add('intro-beendet'); return; } + if (eingerastet) return; zeichnen(); }, { passive: true }); diff --git a/public/custom/transitions.js b/public/custom/transitions.js index fd7e9f0..ab71205 100644 --- a/public/custom/transitions.js +++ b/public/custom/transitions.js @@ -105,7 +105,10 @@ } }); - /* ---------- 4b) Dock einblenden beim Scrollen (nur ohne Tiefenflug-Intro) ---------- */ + /* ---------- 4b) Dock einblenden beim Scrollen + - ohne Intro (Unterseiten): ab scrollY > 200 sichtbar + - mit Intro (Startseite): ausgeblendet, bis html.intro-beendet gesetzt + ist (siehe tiefenflug.js) – dann sofort sichtbar. ---------- */ var dock = document.getElementById("dock"); var hatIntro = document.querySelector(".flug-strecke"); if (dock && !hatIntro) { @@ -115,5 +118,18 @@ }; window.addEventListener("scroll", prüfen, { passive: true }); prüfen(); + } else if (dock && hatIntro) { + var beobachterIntro = new MutationObserver(function () { + if (document.documentElement.classList.contains("intro-beendet")) { + dock.classList.add("sichtbar"); + beobachterIntro.disconnect(); + } + }); + beobachterIntro.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] }); + // Fallback: ist die Klasse schon gesetzt (reduced-motion / Reload am Seitenende)? + if (document.documentElement.classList.contains("intro-beendet")) { + dock.classList.add("sichtbar"); + beobachterIntro.disconnect(); + } } })();