/** * BXHorizon Theme - Main JavaScript * CMS-Native Manageable Theme */ (function () { 'use strict'; // Header scroll effect var bxHeader = document.getElementById('bxHeader'); if (bxHeader) { window.addEventListener('scroll', function () { if (window.scrollY > 50) { bxHeader.classList.add('scrolled'); } else { bxHeader.classList.remove('scrolled'); } }); } // Intersection Observer for scroll animations var observerOptions = { root: null, rootMargin: '0px', threshold: 0.15 }; var observer = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { entry.target.classList.add('is-visible'); observer.unobserve(entry.target); } }); }, observerOptions); document.querySelectorAll('.bx-animate-up').forEach(function (el) { observer.observe(el); }); // Success overlay handling (for contact forms) var successOverlay = document.getElementById('bxSuccessOverlay'); var closeSuccessBtn = document.getElementById('bxCloseSuccess'); if (closeSuccessBtn && successOverlay) { closeSuccessBtn.addEventListener('click', function () { successOverlay.classList.remove('active'); document.body.style.overflow = ''; }); } // Expose showBxSuccess for form handlers window.showBxSuccess = function () { if (successOverlay) { successOverlay.classList.add('active'); document.body.style.overflow = 'hidden'; } }; })();