【发布时间】:2014-04-22 00:31:18
【问题描述】:
当您将光标从图像上移开时,我要做的是让图标回滚。目前,它们在悬停时滚动,但当我悬停时,我希望它们回滚到初始位置。有什么想法吗?
<head>
<style>
ul#roller> li {
float: left;
padding: 20px;
border-radius: 60px;
width: 80px;
height: 80px;
margin-left: 10px;
margin-top: 90px;
}
ul#roller> li:nth-child(1) {
background: url('http://praxis.cit.ie/~josephwinfield/wordpress/wp-content/themes/jaywin/img/1.png') center center no-repeat ;
}
ul#roller> li:nth-child(2) {
background: url('http://praxis.cit.ie/~josephwinfield/wordpress/wp-content/themes/jaywin/img/2.png') center center no-repeat ;
}
ul#roller> li:nth-child(3) {
background: url('http://praxis.cit.ie/~josephwinfield/wordpress/wp-content/themes/jaywin/img/3.png') center center no-repeat ;
}
ul#roller> li:nth-child(4) {
background: url('http://praxis.cit.ie/~josephwinfield/wordpress/wp-content/themes/jaywin/img/4.png') center center no-repeat ;
}
ul#roller> li:nth-child(5) {
background: url('http://praxis.cit.ie/~josephwinfield/wordpress/wp-content/themes/jaywin/img/5.png') center center no-repeat ;
}
ul#roller:hover li {
animation: rotate 2s;
-webkit-animation: rotate 2s;
}
ul#roller:hover {
margin-left: 100px;
}
#roller {
transition: all 2s ease-in-out;
-webkit-transition: all 2s ease-in-out;
height: 400px;
}
#shelf {
background: url('http://praxis.cit.ie/~josephwinfield/wordpress/wp-content/themes/jaywin/img/shelf.jpg') center center no-repeat ;
background-size: 900px;
}
@keyframes rotate {
0% {
translate(0px, 0px;)
}
100% {
transform: rotate(360deg)
translate(0px, 0px);
}
}
@-webkit-keyframes rotate {
0% {
translate(0px, 0px;)
}
100% {
-webkit-transform: rotate(360deg)
translate(0px, 0px);
}
}
</style>
<script>
</script>
</head>
<body>
<div id ="shelf">
<ul id="roller">
<li id="#roller"></li>
<li id="#roller"></li>
<li id="#roller"></li>
<li id="#roller"></li>
<li id="#roller"></li>
</ul>
</div>
</body>
</html>
【问题讨论】:
标签: css animation transition