Created
January 9, 2014 12:26
-
-
Save LeaVerou/8333352 to your computer and use it in GitHub Desktop.
Animation on hover (right way)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ontouchstart="">Hover over me and watch me spin!</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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