| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize animations | |
| const animateElements = document.querySelectorAll('.animate-fade-in'); | |
| animateElements.forEach((el, index) => { | |
| el.style.animationDelay = `${index * 0.1}s`; | |
| }); | |
| // Handle shade parameter in URL for try-on page | |
| if (window.location.pathname.includes('try-on.html')) { | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const shade = urlParams.get('shade'); | |
| if (shade) { | |
| setTimeout(() => { | |
| const shadeBtn = document.querySelector(`#shade-palette button[style*="${shade}"]`); | |
| if (shadeBtn) { | |
| shadeBtn.click(); | |
| } | |
| }, 500); | |
| } | |
| } | |
| // Mobile menu toggle functionality will be handled by navbar component | |
| }); | |
| // Shared utility functions | |
| function debounce(func, wait = 100) { | |
| let timeout; | |
| return function(...args) { | |
| clearTimeout(timeout); | |
| timeout = setTimeout(() => { | |
| func.apply(this, args); | |
| }, wait); | |
| }; | |
| } |