Skip to content

Instantly share code, notes, and snippets.

@dziudek
Created March 28, 2012 14:13
Show Gist options
  • Save dziudek/2226522 to your computer and use it in GitHub Desktop.
Save dziudek/2226522 to your computer and use it in GitHub Desktop.
Rotating elements - list :)
/**
* Rotating elements - list :)
*/
ul {
margin:0;
padding:0;
}
ul li {
float:left;
list-style-type:none;
margin-right: 20px;
}
ul li span {
display:block;
text-align: center;
padding: 10px 0;
}
ul li div {
width: 100px;
height: 100px;
background: #a00;
animation-name: rotateback;
animation-iteration-count: 1;
animation-duration: 0.65s;
animation-direction: alternate;
animation-fill-mode: both;
text-indent: -9999px;
border-radius: 50%;
}
ul li:hover div,
ul li.active div {
animation-name: rotate;
animation-iteration-count: 1;
animation-duration: 0.65s;
animation-direction: alternate;
animation-fill-mode: both;
}
ul li.active:hover div {
animation-duration: 0s;
}
@keyframes rotate {
from { transform: rotateY(0deg); background: #a00; }
49% { background: #a00; }
50% { transform: rotateY(90deg); background: #0a0; }
to { transform: rotateY(0deg); background: #0a0; }
}
@keyframes rotateback {
from { transform: rotateY(0deg); background: #0a0; }
49% { transform: rotateY(90deg); background: #0a0; }
50% { background: #a00; }
to { transform: rotateY(0deg); background: #a00; }
}
<!-- content to be placed inside <body>…</body> -->
<ul>
<li class="active"><div>Icon</div><span>Lorem</span></li>
<li><div>Icon</div><span>Ipsum</span></li>
<li><div>Icon</div><span>Dolor</span></li>
<li><div>Icon</div><span>Sit</span></li>
<li><div>Icon</div><span>Amet</span></li>
</ul>
{"view":"split","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment