【发布时间】:2017-06-04 00:38:41
【问题描述】:
我正在自学 JQuery,昨天晚上我偶然发现了一个疑问,从那时起就陷入了困境。 简单:我需要动画循环重复。但它不起作用,你能帮帮我吗?我试过setInterval,它不起作用。 小提琴是:https://jsfiddle.net/8v5feL9u/
$(document).ready(function(){
//window.setInterval(function(){
$(".img1").css({display:''});
$(".img1").animate({bottom: '300px', opacity: '1'}, 2000, function(){
$(".img1").fadeOut(700);
$(".img1").css({display:'none', bottom: '', opacity:'0'});
$(".img2").css({display:''});
$(".img2").animate({top: '300px', opacity: '1'}, 2000, function(){
$(".img2").fadeOut(700);
$(".img2").css({display:'none', top: '', opacity:'0'});
$(".img3").css({display:''});
$(".img3").animate({bottom: '300px', opacity: '1'}, 2000, function(){
$(".img3").fadeOut(700);
$(".img3").css({display:'none', bottom: '', opacity:'0'})
$(".img4").css({display:''});
$(".img4").animate({top: '300px', opacity: '1'}, 2000, function(){
$(".img4").fadeOut(700);
$(".img4").css({display:'none', top: '', opacity:'0'});
});
});
});
});
//});
});
非常感谢。
【问题讨论】:
标签: javascript jquery html frontend