I'm currently attempting to create an animation on an image using HTML/CSS. The issue I'm facing is that the animation triggers upon page load, but I would like it to activate when scrolling down to the image.
Below is my snippet of HTML:
<figure>
<img src="Assets/Images/klenet.jpg" id="clenet_picture">
<figcaption id="clenet_text">Clenet Series 1 from 1979.</figcaption>
</figure>
And this is my CSS section:
#clenet_picture
{
. . .
animation-name: image-anim;
animation-duration: 4s;
}
@keyframes image-anim
{
from {opacity: 0%}
to {opacity: 100%}
}
I understand that I need to incorporate some JavaScript to achieve the desired effect, but I'm unsure of how exactly to implement it. Can anyone guide me through that process?