【发布时间】:2016-03-26 03:53:27
【问题描述】:
我正在使用关键帧在鼠标悬停时创建无限放大和缩小 div。 正如您从父框下方的链接中看到的那样,增加其大小,然后子 div 开始放大和缩小。 我希望在鼠标移出时,在父 div 缩小之前,子 div 以平滑的方式恢复到其常规大小。 现在,如您所见,它突然恢复到原来的大小,没有任何平滑度。
我的关键帧:
@keyframes imageZoom {
0% { transform: scale(1); }
50% { transform: scale(1.24); }
100% { transform: scale(1);}
}
@-moz-keyframes imageZoom {
0% { -moz-transform: scale(1);}
50% { -moz-transform: scale(1.24); }
100% { -moz-transform: scale(1); }
}
@-webkit-keyframes imageZoom {
0% { -webkit-transform: scale(1); }
50% {-webkit-transform: scale(1.24); }
100% { -webkit-transform: scale(1); }
}
@-ms-keyframes imageZoom {
0% { -ms-transform: scale(1); }
50% { -ms-transform: scale(1.24); }
100% { -ms-transform: scale(1); }
}
子 div 样式:
#myFeaturedItems:hover article {
animation: imageZoom linear 50s;
animation-iteration-count: infinite;
-webkit-animation: imageZoom linear 50s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-delay: 1.5s;
animation-delay: 1.5s;
}
#myFeaturedItems article {
background-image: url('https://images.unsplash.com/photo-1447688812233-3dbfff862778?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=01b98cd0603404826ec5df6d9ef46dfc');
background-position: center center;
background-size: cover;
display: block;
height: 100%;
width: 100%;
}
我的演示链接:http://emanuelezenoni.com/dev/test/
非常感谢!
【问题讨论】:
标签: css css-animations