Adds a fade-in and fade-out effect to a JavaScript modal by transitioning opacity with simple CSS animations. It shows how to use the animationend event so the display property changes only after the fade-out finishes.
What you’ll learn
✓Animate a modal's opacity with CSS keyframes triggered from JavaScript
✓Delay setting display none until an animationend event fires
✓Remove event listeners cleanly after an animation completes