I REPLIED BELOW
Is there a way to make the header of my webpage fade out when scrolled and then be hidden using style.display? Here's what I have so far:
<script type="text/javascript>
function Scroll()
{
var head = document.getElementById('header')
if (window.pageYOffset > 1)
{
head.style.display = "none";
head.style.opacity = "0";
} else {
head.style.display = "block";
head.style.opacity = "1";
}
}
window.addEventListener("scroll",Scroll);
</script>
I'm unsure how to include a 2-second delay before executing
document.getElementById('header').style.display = "none"
.
I've set up a fade-out animation in the <style>
tag using .opacity, but I just need help with the .display delay.
I'd prefer to stick to HTML, JavaScript, or CSS as I'm not familiar with JQuery or other external libraries. Thanks for your understanding! (I'm still learning)