const headerElement = document.querySelector("header");

const updateHeader = () => {
	document.documentElement.scrollTop > 0
		? headerElement.classList.remove("transparent")
		: headerElement.classList.add("transparent")
}

window.addEventListener("scroll", updateHeader);
updateHeader();