Hello everyone,
I would like to start by apologizing for any mistakes in my English.
I have been working on a website, which is currently available here:
As you scroll down, the height of the image below the menu decreases. I am trying to make the navigation arrows for the slideshow disappear by transitioning their opacity to 0.
However, I have encountered an issue where if you quickly scroll up after scrolling down, the arrows still appear with some opacity (e.g., 0.6). My goal is to have the arrows completely hidden when they are out of view without a transition. When you scroll back up to see the image again, the arrows should reappear with a smooth transition.
Thank you all for your assistance!
Javascript (focusing on arrows 1 and 2):
function yScroll(){
arrow1 = document.getElementById('arrow1');
arrow2 = document.getElementById('arrow2');
yPos = window.pageYOffset;
if(yPos > 100 && yPos < 370){
arrow1.style.opacity = "0.8";
arrow2.style.opacity = "0.8";
} else if(yPos > 370){
arrow1.style.opacity = "0.0";
arrow2.style.opacity = "0.0";
}
}
var animateInterval = setInterval(yScroll,10);
CSS:
#mainbox #photo #arrow1 {
transition: opacity 1s ease-in 1.3s;
}
#mainbox #photo #arrow2 {
transition: opacity 1s ease-in 1.3s;
}