Scroll Position of the shrink header

How can I set the the scroll position to shrink the header? I want it to shrink as soon as the page scrolls. I tried some javascript but does not work

`

window.addEventListener(‘scroll’, function () {

let fls = document.querySelector(’.fl-theme-builder-header-sticky’)
let scrollPosition = window.scrollY

if (scrollPosition >= 90) {

    fls.classList.add('fl-theme-builder-header-shrink')}

`

Someone can help me?