kondisi gulir windows

window.onscroll =  ()  =>{
    // called when the window is scrolled.
    if (window.scrollY >= 30) {

        //your event
        console.log(window.scrollY);

    } else {
        //your event
    }
}
Avgilles