Pause and resume CSS3 animations w/ CSS!
If you <3 CSS3 animations as much as I do, you'll be delighted to know that there's an easy way to pause an animation: animation-play state
Here are the styles I use to keep all the animations on a page from playing until a user has clicked a "play" button, which puts a class of "playing" on the body tag.
* {
animation-play-state: paused;
}
.playing * {
animation-play-state: running;
}
Written by Rachel Nabors
Related protips
4 Responses

Thanks for this! I thought animation-play-state
is not widely supported, but the support is actually really good.
over 1 year ago
·

@timpietrusky Yeah, it's totally in the "It works on recent versions of all the browsers, so ship it!" zone ;)
over 1 year ago
·

@rachelnabors Good enough to play with it if you ask me :D
over 1 year ago
·

This is awesome, thanks for sharing!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css3
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#