// Blogs button functionality const blogsButton = document.getElementById('blogsButton'); blogsButton.addEventListener('click', () => { window.location.href = '../index.html#blogs'; }); // Contact button functionality const contactButton = document.getElementById('contactButton'); contactButton.addEventListener('click', () => { window.location.href = '../contact.html'; }); // Scroll header logic - FIXED let lastScrollTop = 0; const mainHeader = document.querySelector('.header-container'); const scrollHeader = document.getElementById('scrollHeader'); window.addEventListener('scroll', function() { let scrollTop = window.pageYOffset || document.documentElement.scrollTop; // Adjust scroll threshold for mobile const scrollThreshold = window.innerWidth < 768 ? 50 : 100; if (scrollTop > lastScrollTop && scrollTop > scrollThreshold) { // Scrolling down - show scroll header mainHeader.style.top = "-120px"; scrollHeader.style.top = "15px"; } else { // Scrolling up - show main header mainHeader.style.top = "0"; scrollHeader.style.top = "-90px"; } lastScrollTop = scrollTop; }); // Hover effects document.querySelectorAll('.nav-link, .right-buttons button, .logo-area').forEach(element => { element.addEventListener('mouseenter', function() { this.style.transform = 'translateY(-2px)'; }); element.addEventListener('mouseleave', function() { this.style.transform = 'translateY(0)'; }); }); // Add subtle animation to navbar on load window.addEventListener('load', () => { const navbar = document.querySelector('.navbar'); navbar.style.transform = 'translateY(-20px)'; navbar.style.opacity = '0'; setTimeout(() => { navbar.style.transition = 'all 0.5s ease'; navbar.style.transform = 'translateY(0)'; navbar.style.opacity = '1'; }, 300); }); // Floating icons visibility logic const floatingIcons = document.getElementById('floatingIcons'); const backToTop = document.getElementById('backToTop'); window.addEventListener('scroll', function() { const scrollTop = window.pageYOffset || document.documentElement.scrollTop; const windowHeight = window.innerHeight; const documentHeight = document.documentElement.scrollHeight; // Show floating icons after 100vh of scrolling if (scrollTop > windowHeight) { floatingIcons.classList.add('visible'); } else { floatingIcons.classList.remove('visible'); } // Hide floating icons when there's only 100vh left at the bottom if (scrollTop + windowHeight >= documentHeight - windowHeight) { floatingIcons.classList.remove('visible'); } // Show back to top button after scrolling down if (scrollTop > 300) { backToTop.classList.add('visible'); } else { backToTop.classList.remove('visible'); } }); // Back to top functionality backToTop.addEventListener('click', function(e) { e.preventDefault(); window.scrollTo({ top: 0, behavior: 'smooth' }); }); // Mobile navigation functionality const mobileNavToggle = document.getElementById('mobileNavToggle'); const mobileNav = document.getElementById('mobileNav'); const mobileNavOverlay = document.getElementById('mobileNavOverlay'); mobileNavToggle.addEventListener('click', () => { mobileNav.classList.toggle('active'); mobileNavOverlay.classList.toggle('active'); // Change icon based on state const icon = mobileNavToggle.querySelector('i'); if (mobileNav.classList.contains('active')) { icon.className = 'fas fa-times'; } else { icon.className = 'fas fa-bars'; } }); mobileNavOverlay.addEventListener('click', () => { mobileNav.classList.remove('active'); mobileNavOverlay.classList.remove('active'); // Reset icon const icon = mobileNavToggle.querySelector('i'); icon.className = 'fas fa-bars'; });