fix: scroll-class check on load, hero null guard, JS syntax fix
This commit is contained in:
@@ -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
|
||||
// Hero animation on load (only if hero elements exist)
|
||||
var heroContent = document.getElementById("heroContent");
|
||||
var heroBg = document.getElementById("heroBg");
|
||||
if (heroContent || heroBg) {
|
||||
setTimeout(function () {
|
||||
document.getElementById("heroContent").classList.add("visible");
|
||||
document.getElementById("heroBg").classList.add("loaded");
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user