Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created January 9, 2014 12:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save LeaVerou/8333352 to your computer and use it in GitHub Desktop.
Save LeaVerou/8333352 to your computer and use it in GitHub Desktop.
Animation on hover (right way)
/**
* Animation on hover (right way)
*/
div {
width: 9em;
padding: .6em 1em;
margin: 2em auto;
background: yellowgreen;
animation: spin 1s linear infinite;
animation-play-state: paused;
}
@keyframes spin {
to {
transform: rotate(1turn);
}
}
div:hover {
animation-play-state: running;
}
<div ontouchstart="">Hover over me and watch me spin!</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment