SAE_S1.05_S1.06/js/script.js

26 lines
732 B
JavaScript

document.addEventListener('DOMContentLoaded', function () {
const burgerMenu = document.querySelector('.burger-menu');
const navLinks = document.querySelector('.nav-links');
burgerMenu.addEventListener('click', function () {
navLinks.classList.toggle('show');
});
});
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
// Afficher ou masquer le bouton en fonction de la position de défilement
document.addEventListener('scroll', function () {
const scrollTopBtn = document.getElementById('scrollTopBtn');
if (window.scrollY > 200) {
scrollTopBtn.style.display = 'block';
} else {
scrollTopBtn.style.display = 'none';
}
});