document.addEventListener('DOMContentLoaded', function() { // Mobile menu toggle const menuToggle = document.getElementById('menu-toggle'); const navList = document.querySelector('.nav-list'); menuToggle.addEventListener('click', function() { navList.classList.toggle('active'); }); // Testimonial slider const testimonialCards = document.querySelectorAll('.testimonial-card'); const prevBtn = document.getElementById('prev-testimonial'); const nextBtn = document.getElementById('next-testimonial'); let currentIndex = 0; function showTestimonial(index) { testimonialCards.forEach(card => { card.classList.remove('active'); }); testimonialCards[index].classList.add('active'); } prevBtn.addEventListener('click', function() { currentIndex = (currentIndex - 1 + testimonialCards.length) % testimonialCards.length; showTestimonial(currentIndex); }); nextBtn.addEventListener('click', function() { currentIndex = (currentIndex + 1) % testimonialCards.length; showTestimonial(currentIndex); }); // Auto-rotate testimonials every 5 seconds setInterval(function() { currentIndex = (currentIndex + 1) % testimonialCards.length; showTestimonial(currentIndex); }, 5000); // Add to cart buttons const addToCartButtons = document.querySelectorAll('.blend-card .btn-secondary'); addToCartButtons.forEach(button => { button.addEventListener('click', function() { const blendName = this.parentElement.querySelector('h3').textContent; // Create notification element const notification = document.createElement('div'); notification.className = 'notification'; notification.textContent = `${blendName} added to cart!`; notification.style.position = 'fixed'; notification.style.bottom = '20px'; notification.style.right = '20px'; notification.style.backgroundColor = '#4caf50'; notification.style.color = 'white'; notification.style.padding = '12px 20px'; notification.style.borderRadius = '4px'; notification.style.boxShadow = '0 4px 8px rgba(0,0,0,0.2)'; notification.style.zIndex = '1000'; notification.style.transform = 'translateY(100px)'; notification.style.opacity = '0'; notification.style.transition = 'transform 0.3s ease, opacity 0.3s ease'; document.body.appendChild(notification); // Animate notification setTimeout(() => { notification.style.transform = 'translateY(0)'; notification.style.opacity = '1'; }, 100); // Remove notification after 3 seconds setTimeout(() => { notification.style.transform = 'translateY(100px)'; notification.style.opacity = '0'; setTimeout(() => { document.body.removeChild(notification); }, 300); }, 3000); }); }); });