fix: scroll-class check on load, hero null guard, JS syntax fix
Some checks failed
Lint / PHP Syntax Check (push) Has been cancelled
Lint / CSS Lint (stylelint) (push) Has been cancelled
Lint / HTML Lint (htmlhint) (push) Has been cancelled

This commit is contained in:
2026-06-02 23:50:55 +02:00
parent ad4284733c
commit b774bd0363

View File

@@ -1,16 +1,23 @@
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
// Navbar scroll // Navbar scroll
var navbar = document.getElementById("navbar"); var navbar = document.getElementById("navbar");
window.addEventListener("scroll", function () { function checkScroll() {
if (window.scrollY > 60) navbar.classList.add("scrolled"); if (window.scrollY > 60) navbar.classList.add("scrolled");
else navbar.classList.remove("scrolled"); else navbar.classList.remove("scrolled");
}); }
// Check immediately on load (for non-hero pages already scrolled)
checkScroll();
window.addEventListener("scroll", checkScroll);
// Hero animation on load // Hero animation on load (only if hero elements exist)
var heroContent = document.getElementById("heroContent");
var heroBg = document.getElementById("heroBg");
if (heroContent || heroBg) {
setTimeout(function () { setTimeout(function () {
document.getElementById("heroContent").classList.add("visible"); if (heroContent) heroContent.classList.add("visible");
document.getElementById("heroBg").classList.add("loaded"); if (heroBg) heroBg.classList.add("loaded");
}, 200); }, 200);
}
// Scroll animations via IntersectionObserver // Scroll animations via IntersectionObserver
var animElements = document.querySelectorAll(".fact, [data-animate]"); var animElements = document.querySelectorAll(".fact, [data-animate]");
@@ -178,7 +185,6 @@ document.addEventListener("DOMContentLoaded", function () {
// Form submit is handled server-side by PHP no JS intervention needed. // Form submit is handled server-side by PHP no JS intervention needed.
// Success feedback is shown via #form-result after server redirect. // Success feedback is shown via #form-result after server redirect.
}); });
});
// Mobile hamburger menu (vanilla JS) // Mobile hamburger menu (vanilla JS)
(function () { (function () {