CSS3 Animate Out of :hover

Andrew picture Andrew · Nov 23, 2011 · Viewed 15.7k times · Source

I'm setting up a simple animation that brings up a little additional information when you hover over an image. The jQuery backup part is written and works fine, though the issue I'm having trouble with is getting the CSS3 animation to go in reverse when the user hovers out.

So when you hover in it works great, but as soon as you hover out the elements just disappear. What I'd like to know is if there's a way to get them to animate backwards when the mouse hovers elsewhere. Thanks a lot!

Answer

bookcasey picture bookcasey · Nov 23, 2011

You don't need keyframes for something as simple as this.

I made you a demo (with only -webkit vender prefixes to keep things simple).