Making a CSS fade out for a slideshow?

How can I get a fade out? I have a fade in but cannot figure out fading out.

Here is the code: https://codepen.io/GiacomoLaw/pen/YdbRwP

Thanks!

I can’t do css fade outs, but I can do them REALLY WELL in JQuery.
you can try the effect at this program I made.
https://www.khanacademy.org/computer-programming/cool-effects/6351960483201024

Thanks, I’ll take a look!

I think you can, using the opacity within a transition. If you want one fade out need other transition the opacity 1 to 0.x

Can you give me a demo? Spent a long time on this and could not figure it out :confused:

Try changing the animation to this.

@keyframes fade {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
1 Like

Thanks I’ll give it a go once I’m back on my pc!

I also recommend you to look up for the .fadeIn() function of JQuery, since you can set it to wait until the page is ready to start the animation, avoiding the transiction to behave weirdly :smiley:

you can find videos on yt with simple ways to apply it!

I found this gem somewhere: https://codepen.io/davidhc/pen/nLpJk