cherkif's picture
Redesign my website
0f6867f verified
Raw History Blame Contribute Delete
1.1 kB
// Mobile menu toggle functionality
document.addEventListener('DOMContentLoaded', function() {
// Smooth scroll 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'
});
}
});
});
// Initialize tooltips if using any
if (typeof tippy !== 'undefined') {
tippy('[data-tippy-content]', {
arrow: true,
animation: 'shift-away'
});
}
});
// Form submission handling
const contactForm = document.getElementById('contactForm');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
// Add your form submission logic here
alert('Merci pour votre message! Nous vous contacterons bientôt.');
this.reset();
});
}