Jquery 动画不';在firefox的第二次迭代中无法工作
我用一些动画制作了一个滑块,它在谷歌chrome中工作,但在firefox中,它一开始工作得很好(第一次显示图像) 但是当它第二次开始显示图像时,我看不到动画 这是jquery代码Jquery 动画不';在firefox的第二次迭代中无法工作,jquery,css,animation,mozilla,Jquery,Css,Animation,Mozilla,我用一些动画制作了一个滑块,它在谷歌chrome中工作,但在firefox中,它一开始工作得很好(第一次显示图像) 但是当它第二次开始显示图像时,我看不到动画 这是jquery代码 var anim = function(index){ return _start = setInterval(function(){ $($slides).each(function(){ $(this).removeClass("current");
var anim = function(index){
return _start = setInterval(function(){
$($slides).each(function(){
$(this).removeClass("current");
});
$($pages).each(function(){
$(this).removeClass("active");
});
if(index < $slides.length - 1)
index++;
else
index = 0;
current = index;
$($slides[index]).addClass("current");
$($pages[index]).addClass("active");
},speed);
}
在线查看,我认为您需要一个迭代计数器。像这个
animation-iteration-count: infinite;
animation-duration: 2.5s;
请在JSFIDLE、plunker、jsbin或codepen中设置一个示例。它适用于图像动画,因为它与setInterval duration有5秒相同。。。但是文本有2.5秒,所以它会重复动画两次。。。文本完成后,是否有可能停止动画2.5秒?
animation-iteration-count: infinite;
animation-duration: 2.5s;