Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ // Smooth scrolling for anchor links
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function(e) {
+ e.preventDefault();
+
+ const targetId = this.getAttribute('href');
+ if (targetId === '#') return;
+
+ const targetElement = document.querySelector(targetId);
+ if (targetElement) {
+ window.scrollTo({
+ top: targetElement.offsetTop - 80,
+ behavior: 'smooth'
+ });
+ }
+ });
+ });
+
+ // Form submission handling
+ const contactForm = document.querySelector('.contact-form');
+ if (contactForm) {
+ contactForm.addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ // In a real app, you would send the form data to a server
+ alert('Thank you for your message! We will get back to you soon.');
+ this.reset();
+ });
+ }
+
+ // Product hover effects
+ const productCards = document.querySelectorAll('.product-card');
+ productCards.forEach(card => {
+ card.addEventListener('mouseenter', function() {
+ const img = this.querySelector('.product-image');
+ const fragrance = img.getAttribute('data-fragrance');
+
+ // Add a subtle animation to the product image
+ img.style.transition = 'all 0.5s ease';
+ img.style.transform = 'scale(1.05)';
+ });
+
+ card.addEventListener('mouseleave', function() {
+ const img = this.querySelector('.product-image');
+ img.style.transform = 'scale(1)';
+ });
+ });
+
+ // Scroll reveal animation
+ const animateOnScroll = function() {
+ const elements = document.querySelectorAll('.product-card, .benefit, .about-content');
+
+ elements.forEach(element => {
+ const elementPosition = element.getBoundingClientRect().top;
+ const screenPosition = window.innerHeight / 1.3;
+
+ if (elementPosition < screenPosition) {
+ element.style.opacity = '1';
+ element.style.transform = 'translateY(0)';
+ }
+ });
+ };
+
+ // Set initial state for animation
+ const animatedElements = document.querySelectorAll('.product-card, .benefit, .about-content');
+ animatedElements.forEach(el => {
+ el.style.opacity = '0';
+ el.style.transform = 'translateY(20px)';
+ el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
+ });
+
+ window.addEventListener('scroll', animateOnScroll);
+ animateOnScroll(); // Run once on load
+ });