【发布时间】:2013-06-12 20:25:54
【问题描述】:
我遇到了一些麻烦 我的第一个动画在页面加载时工作正常,但是我想在你悬停图形元素时触发另一个动画,如果你这样做,第一个动画会重复,但显然,如果你把鼠标放在红色框上并强制它转到原始位置,然后我的第二个动画工作:/
是关键帧元素属于它的第一个位置吗?我做到了绝对,是一样的。 您可以在此处查看工作代码: http://jsfiddle.net/zhk7w/ 谢谢你的手!
<div id="wrapper">
<article>
<div id="sharing-wrapper">
<figure>
<a class="animate" href="#">p</a>
</figure>
</div>
<div class="test">
<a class="test" href="">C</a>
</div>
</article>
</div>
还有css:
#sharing-wrapper figure{
margin-left: 50px;
position: relative;
width: 20px;
height: 20px;
}
#sharing-wrapper figure{
padding: 15px;
background-color: red;
position: relative;
-webkit-animation-name:animatetopbottom,animateleft;
-webkit-animation-duration:3s,3s;
-webkit-animation-fill-mode:forwards;
/*-webkit-animation-direction:alternate;*/
}
#sharing-wrapper figure:hover{
-webkit-animation: shakeit 1s;}
动画:
@-webkit-keyframes animateleft{
from {left: 0px;}
to {left: 50px;}
}
@-webkit-keyframes animatetopbottom{
0% {top: 0px;}
10% {top: 90px;}
20% {top: 60px;-webkit-transform:rotate(680grad);}
30% {top: 90px;-webkit-transform:scale(0.7);}
40% {-webkit-transform:scale(1.5);}
50% {top: 60px;-webkit-transform:rotate(0grad);}
80% {top: 80px;}
100% {top: 80px;}
}
@-webkit-keyframes shakeit{
from { top: 25px; }
to { top: -40px; }
}
【问题讨论】:
标签: css hover css-animations