Crée un site web corporate premium pour une startup technologique de comparaison d’assurances nommée Marianne Compare.
f1957cb verified | document.addEventListener('DOMContentLoaded', function() { | |
| // Carousel functionality | |
| const carousel = document.getElementById('carousel'); | |
| const prevBtn = document.getElementById('prevBtn'); | |
| const nextBtn = document.getElementById('nextBtn'); | |
| if (carousel && prevBtn && nextBtn) { | |
| let scrollAmount = 0; | |
| const scrollStep = 300; | |
| const maxScroll = carousel.scrollWidth - carousel.clientWidth; | |
| prevBtn.addEventListener('click', () => { | |
| scrollAmount = Math.max(scrollAmount - scrollStep, 0); | |
| carousel.scrollTo({ | |
| left: scrollAmount, | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| nextBtn.addEventListener('click', () => { | |
| scrollAmount = Math.min(scrollAmount + scrollStep, maxScroll); | |
| carousel.scrollTo({ | |
| left: scrollAmount, | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| } | |
| // Animate elements on scroll | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.fade-in, .slide-up'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const windowHeight = window.innerHeight; | |
| if (elementPosition < windowHeight - 100) { | |
| element.style.opacity = '1'; | |
| element.style.transform = 'translateY(0)'; | |
| } | |
| }); | |
| }; | |
| // Initial check | |
| animateOnScroll(); | |
| // Check on scroll | |
| window.addEventListener('scroll', animateOnScroll); | |
| // 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 - 100, | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Form submission handling | |
| const contactForm = document.querySelector('form'); | |
| if (contactForm) { | |
| contactForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Here you would typically send the form data to your server | |
| // For demo purposes, we'll just show a success message | |
| alert('Merci pour votre intérêt ! Nous vous contacterons dès que Marianne Compare sera disponible.'); | |
| this.reset(); | |
| }); | |
| } | |
| }); |