function myFunction() {
    if (window.pageYOffset > sticky) {
      header.classList.add("stickyNav");
    } else {
      header.classList.remove("stickyNav");
    }
  }
// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
Add the sticky class to the header when you reach its scroll position . Remove " sticky " when you leave the scroll position
function myFunction() {
    if (window.pageYOffset > sticky) {
      header.classList.add("stickyNav");
    } else {
      header.classList.remove("stickyNav");
    }
  }
function myFunction ( ) { if ( window . pageYOffset > sticky ) { header . classList . add ( "stickyNav" ) ; } else { header . classList . remove ( "stickyNav" ) ; } }
Add the sticky class to the header when you reach its scroll position.
Add the sticky class to the header when you reach its scroll position .