Created
June 20, 2021 01:16
-
-
Save wes-goulet/4d4c2a1f83f48b4b23441f90cf2902b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onscroll = function () { | |
/** @type {HTMLElement | null} */ | |
const header = document.querySelector('header'); | |
if (header !== null) { | |
if (window.scrollY < 5) { | |
header.classList.remove('scrolled'); | |
} else { | |
header.classList.add('scrolled'); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment