我在悬停图形图像时为跳出效果创建关键帧。我有一切正常,但一旦动画完成..图标消失。
我知道它与电子邮件中设置的translateY属性有关并且在课堂上链接。
在悬停时,我尝试添加最终的translateY属性,但一切都变得很糟糕......
模块动画HTML
<div class="team-container">
<figure>
<div class="circle-item">
<img class="member-image" src="http://sandbox.techgrayscale.com/wp-content/uploads/2016/07/member-image-blank.png">
<div class="image-cover">
</div>
<div class="icons">
<a class="email" href="#"><img src="http://sandbox.techgrayscale.com/wp-content/themes/TGSnew/assets/images/email-icon.png"></a>
<a class="linkedin" href="#"><img src="http://sandbox.techgrayscale.com/wp-content/themes/TGSnew/assets/images/linkedin-icon.png"></a>
</div>
<!--end image cover -->
</div>
<!--end circle item -->
</figure>
</div>
图标CSS
.tgs-team figure .circle-item .icons {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
}
.tgs-team figure .circle-item .icons:after {
content: '';
width: 1px;
height: 0;
position: absolute;
background-color: #fff;
left: 50%;
bottom: -50%;
transition: height .3s linear;
}
.tgs-team figure .circle-item .icons a {
display: inline-block;
}
.tgs-team figure .circle-item .icons .email {
margin-right: 20px;
transform: translateY(120px);
}
.tgs-team figure .circle-item .icons .linkedin {
margin-left: 20px;
transform: translateY(120px);
}
Keyframe CSS
@keyframes iconBounce {
0% {
transform: translateY(120px);
opacity: 0;
}
50% {
transform: translateY(0px);
opacity: 1;
}
75% {
transform: translateY(-10px);
}
100% {
transform: translateY(0px);
}
}
悬停CSS:
.tgs-team figure:hover .image-cover {
transform: translateY(0);
transition: transform .3s ease-out;
}
.tgs-team figure:hover .icons:after {
height: 88px;
}
.tgs-team figure:hover .icons .email {
animation: iconBounce .40s linear .1s;
}
.tgs-team figure:hover .icons .linkedin {
animation: iconBounce .40s linear .2s;
}
.tgs-team .member-info .name {
font-size: 1.875rem;
}
.tgs-team .member-info .position {
font-weight: 100;
}
}
我对如何使其工作感到茫然....我需要图标才能显示,直到悬停的关键帧将它们带入并留在那里直到用户将图形悬停。
答案 0 :(得分:0)
调用动画时添加前进。
更新了悬停CSS
.tgs-team figure:hover .image-cover {
transform: translateY(0);
transition: transform .3s ease-out;
}
.tgs-team figure:hover .icons:after {
height: 88px;
}
.tgs-team figure:hover .icons .email {
animation: iconBounce .40s linear .1s forwards;
}
.tgs-team figure:hover .icons .linkedin {
animation: iconBounce .40s linear .2s forwards;
}
.tgs-team .member-info .name {
font-size: 1.875rem;
}
.tgs-team .member-info .position {
font-weight: 100;
}
}
默认情况下,关键帧在完成时会循环回来。前锋是动画填充属性,以防止这种情况发生。
您可以在此处了解更多信息:
http://www.w3schools.com/cssref/css3_pr_animation-fill-mode.asp