1const AutoBackToTop = () => { 2 const backToTopButton = document.querySelector(".js-back-to-top"); 3 if (backToTopButton === null) return; 4 // Afficher ou masquer le lien en fonction de la position de la page 5 function handleScroll() { 6 const scrollPosition = window.scrollY || document.documentElement.scrollTop; 7 scrollPosition > 300 8 ? backToTopButton.classList.add("is-visible") 9 : backToTopButton.classList.remove("is-visible"); 10 } 11 12 // Retourner en haut de la page au clic sur le lien 13 function handleBackToTop(event) { 14 event.preventDefault(); 15 window.scrollTo({ 16 top: 0, 17 behavior: "smooth", 18 }); 19 backToTopButton.blur(); 20 } 21 22 if (backToTopButton) { 23 // Ajouter les événements pour le scroll et le clic 24 window.addEventListener("scroll", handleScroll); 25 26 backToTopButton.addEventListener("click", handleBackToTop); 27 } 28}; 29 30const load_AutoBackToTop = window.addEventListener( 31 "DOMContentLoaded", 32 AutoBackToTop 33); 34 35// export your function at the bottom as follows 36export { load_AutoBackToTop };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.