// DARK MODE document.addEventListener("DOMContentLoaded", function() { const switchTheme = document.querySelector("#switch"); switchTheme.addEventListener("click", function () { document.body.classList.toggle("dark-mode"); }); }); // CAROUSSEL document.addEventListener("DOMContentLoaded", function () { const track = document.querySelector('.carousel-track'); let index = 0; function updateSlide() { const slideWidth = document.querySelector('.carousel-slide').offsetWidth; track.style.transform = `translateX(-${index * slideWidth}px)`; } setInterval(() => { index = (index + 1) % document.querySelectorAll('.carousel-slide').length; updateSlide(); }, 3000); }); // BOUTON document.addEventListener("DOMContentLoaded", function () { const container = document.querySelector('.button-area'); const button = document.getElementById('trickyButton'); button.addEventListener('mouseenter', () => { const maxX = container.clientWidth - button.offsetWidth; const maxY = container.clientHeight - button.offsetHeight; const randomX = Math.floor(Math.random() * maxX); const randomY = Math.floor(Math.random() * maxY); button.style.left = `${randomX}px`; button.style.top = `${randomY}px`; }); });