我在使用Safari时遇到问题,除了羽毛外,还会模仿浮在空中的气泡效果。我省略了一些代码来了解事物的要点。正在进行的工作的网址是here。
以下是我的动画对象的webkit样式。
@-webkit-keyframes f1 {
100% {
-webkit-transform: translateX(-25px) translateY(-350px);
}
}
.feather {
/* other styling omitted */
-webkit-animation-duration: 7s;
-webkit-animation-timing-function: linear;
}
用javascript创建一堆对象。
animateFeathers = function() {
var $feather = $('<img>'),
$feather.addClass('feather animated');
$feather.attr('src','img/feather.png');
$feather.css('-webkit-animation-name','f1');
$featherContainer.append($feather);
setTimeout(function() {
$feather.remove();
}, 9000);
// random time to create next feather
var rTimeout = Math.random() * maxTime + minTime;
setTimeout(animateFeathers, rTimeout);
}
如果您访问Chrome或Firefox中的link,您会看到预期效果。然而,在Safari(再次,移动或桌面)中,羽毛堆叠并且每7秒仅在一组中生成动画。我希望他们一旦插入DOM就开始动画。关于这个的任何想法?