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