我们可以在Jquery中的.animate()函数中使用.delay()函数吗?

时间:2016-11-07 11:16:18

标签: jquery animation

我正在尝试提供包含多个图像的动画,每个图像从不同位置开始动画。我的代码如下。

$(document).ready(function() { 
    setInterval(function() {      
        $("#animate1").fadeIn('slow').animate({
            'margin-left': '220px',
            'margin-bottom': '20px'
        }, 2000, function(){ 
            $('.1st').animate({ 'opacity': '0' }, 1000, function(){
                $('.1st').animate({ 'opacity': '1' })
            })
        }).fadeOut();

        $("#animate1").fadeIn('slow').animate({
            'margin-bottom': '0px',
            'margin-left': '-140px'
        }, 2000, function() {
            $("#animate1").delay(10000).show(0)
        }).fadeOut();
    },600);
});

现在,我想暂停我在#animate1中给出的第一个图像动画的循环并开始另一个动画。所以我在这里应用delay()延迟#animate1一段时间间隔,在那个暂停时间,我希望运行第二个动画。

完成第二部动画后,我再次想要运行第一部动画。那么,我该怎么做呢?

0 个答案:

没有答案
相关问题