Jquery animate when another animation is in progress

后端 未结 4 1621
星月不相逢
星月不相逢 2021-01-20 15:57

I\'m using a simple easing animation given here using JQUERY EASING PLUGIN
i.e.easing a div from left:200 to left:0 and back.(last example on above page)

I have

4条回答
  •  臣服心动
    2021-01-20 16:34

    You can use the ':animated' pseudo-selector to find out if an element is currently in motion:

    if ($('#div1').is(':animated')) {
        // do something
    }
    

    http://api.jquery.com/animated-selector/

    You can also try the step option to check when div2 should start animate:

    $('#div1').animate({
        left:0
    },{
        step: function() {
            // check distance and animate div2 when it reaches 100
        }
    });
    

    http://api.jquery.com/animate/

提交回复
热议问题