Problems with stopping JavaScript animation with multiple queues

  Kiến thức lập trình

See the Pen
animate queue problem by 양갱 (@abllmjdn-the-builder)
on CodePen.

$(".start").click(function(){
    $(".anime1").animate({
        left:'50%',
    },2000);
    $(".anime1").animate({
        left:0,
    },1000);
})


$(".stop").click(function(){
    $(".anime1").clearQueue().stop()
})

As above, I composed an animation with two queues.
During the first queue, press the stop button and press the restart button to stop and start well.
However, if you press the stop button on the second queue and then the start button, the second queue will not be executed, but the first queue will be executed.

Is there any way to solve this?

New contributor

RedBeanJelly is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT