Condição de rolagem do Windows

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

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

    } else {
        //your event
    }
}
Avgilles