我想使用一个触发CSS动画的Javascript函数,将一个div翻转180度。我的div声明如下:
.start-photo-thumb
{
position: relative;
float: left;
background: #444444;
height: 192px;
width: 192px;
margin-right: 10px;
margin-bottom: 10px;
perspective: 1000px;
animation: rotating 0.6s linear infinite;
animation-play-state: paused;
}
@keyframes rotating
{
from
{
transform: rotateY(0deg);
}
to
{
transform: rotateY(180deg);
}
}
我觉得我的尝试走错了方向。
function flipPhoto(box)
{
$('#' + box.id).css('animation-play-state', 'running');
setTimeout(function(){
$('#' + box.id).css('animation-play-state', 'paused');
}, 600);
}
此外,我想在您看不到div时更改background-image(在90度或300毫秒处)。
有更好、更简单的解决方法吗?谢谢!
:rotateY(...)
来绕Y轴旋转。 - dreamweiver