Javascript jQuery慢慢淡入淡出,暂停,然后重复

Javascript jQuery慢慢淡入淡出,暂停,然后重复,javascript,jquery,Javascript,Jquery,我有4张图片在一个列表中,我想慢慢淡出,然后进入,然后移动到下一个,并重复,直到它回到时间。所以我基本上需要使用这段代码,但是让它暂停,直到其他3段代码完成,然后再做一次 我该怎么做呢 $('#image1').animate({ opacity: 1/3 }, 500); $('#image1').animate({ opacity: 1 }, 1000); $('#image2').animate({ opacity: 1/3 }, 2000); $('#image2').animate({

我有4张图片在一个列表中,我想慢慢淡出,然后进入,然后移动到下一个,并重复,直到它回到时间。所以我基本上需要使用这段代码,但是让它暂停,直到其他3段代码完成,然后再做一次

我该怎么做呢

$('#image1').animate({ opacity: 1/3 }, 500);
$('#image1').animate({ opacity: 1 }, 1000);
$('#image2').animate({ opacity: 1/3 }, 2000);
$('#image2').animate({ opacity: 1 }, 2500);
$('#image3').animate({ opacity: 1/3 }, 3500);
$('#image3').animate({ opacity: 1 }, 4000);
$('#image4').animate({ opacity: 1/3 }, 5000);
$('#image4').animate({ opacity: 1 }, 5500);
如何循环它?这是最好的方法吗?

这个怎么样:

var速度=2000; 运行=设置间隔开关滑动,速度; $document.readyfunction{ $'caption'.html$'slideshow img:first'.attr'title'; $“幻灯片显示img:gt0”。隐藏; }; 功能开关滑块{ $'slideshow img:first'。淡出1000.next.show.end.appendTo'slideshow'; $'caption'.html$'slideshow img:first'.attr'title'; } 幻灯片放映{ 宽度:700px; 高度:400px; 填充:0; 位置:相对位置; 溢出:隐藏; 边框:1px实心; } 幻灯片式img{ 位置:绝对位置; 高度:500px; 宽度:700px; } 这个怎么样:

var速度=2000; 运行=设置间隔开关滑动,速度; $document.readyfunction{ $'caption'.html$'slideshow img:first'.attr'title'; $“幻灯片显示img:gt0”。隐藏; }; 功能开关滑块{ $'slideshow img:first'。淡出1000.next.show.end.appendTo'slideshow'; $'caption'.html$'slideshow img:first'.attr'title'; } 幻灯片放映{ 宽度:700px; 高度:400px; 填充:0; 位置:相对位置; 溢出:隐藏; 边框:1px实心; } 幻灯片式img{ 位置:绝对位置; 高度:500px; 宽度:700px; } 功能FadeInutList$元素、持续时间、延迟{ 如果!$elements.size返回 $elements.first.fadeIndication,函数{ setTimeoutfunction{ $elements.first.fadeutduration,函数{ FadeInutList$elements.1,持续时间,延迟 } },延迟 } } fadeInOutList$'img',500,1000 img{ 显示:无; } 功能FadeInutList$元素、持续时间、延迟{ 如果!$elements.size返回 $elements.first.fadeIndication,函数{ setTimeoutfunction{ $elements.first.fadeutduration,函数{ FadeInutList$elements.1,持续时间,延迟 } },延迟 } } fadeInOutList$'img',500,1000 img{ 显示:无; } 看


尝试使用。队列。是否可以在问题中包含html?对于淡入淡出的使用,您希望一个接一个地为图像设置动画还是什么?是的,正如@erkaner所说,我们需要你用HTML来解决这个问题faster@shershen更新的问题。队列。是否可以在问题中包含html?对于淡入淡出的使用,您希望一个接一个地为图像设置动画还是什么?是的,正如@erkaner所说,我们需要你用HTML来解决这个问题faster@shershen更新问题Hey erkaner,你知道你可以在回答中使用StackSnippets吗?它应该是图像旁边的第7个按钮,如果你按下快捷键ctrl+m,它就会出现。如果您将鼠标悬停在工具栏按钮上,则称为代码段。嘿,erkaner,您知道您可以在回答中使用StackSnippets吗?它应该是图像旁边的第7个按钮,如果您按快捷键ctrl+m,它就会出现。如果您将鼠标悬停在工具栏按钮上,则称为代码段。示例中没有任何内容-看起来不可行。示例中没有任何内容-看起来不可行。它不循环-如果可以,则这将是完美的。如果可以,则这将是完美的
$(".fade").each(function(index) {
    $(this).delay(800*index).fadeTo(200, 0.5).fadeTo(200, 1).fadeTo(200, 0.5).fadeTo(200, 1);
});