Quiero iniciar una función solo UNA VEZ solo cuando el usuario se haya desplazado una cierta cantidad o haya pasado una cierta cantidad de tiempo.
ahora mismo estoy haciendo esto -
const startSlides = setTimeout (() => { start(); }, 5000); const doThis = () => { debounce ( () => { if (window.scrollY > window.screen.height * 0.5) { start(); // start the animation of the slides; clearTimeout(startSlides); window.removeEventListener("scroll", doThis); return; } }, 200) }; window.addEventListener ("scroll" , doThis);