How do you know if your website page is scrolled to the top

I am using javascript and would like to have a menu in my website page when the page is scrolled to the top the menu background becomes transparent and when you scroll down the menu background changes and remains at the top of the page. I just can’t find how you can know in javascript if your page is at the top. thanks

/