JQuery custom queue

What I'm trying to do is split the animation so that I can kill some without producing important ones. I am trying to add a mouseenter / mouseleave animation to the queue so that I can kill them when another animation starts. In the code below, nothing is done to stop the queues in the queue. It behaves like the default, when the animation will accumulate in the queue and be played. What gives?

$('.item').mouseenter(function(){
    $(this).clearQueue("test");
    $(this).queue("test",function(next){        
        $(this).animate({
            height: '250px'
        },500);
    });
    $(this).dequeue("test");
}).mouseleave(function(){
    $(this).clearQueue("test");
    $(this).queue("test",function(next){        
        $(this).animate({
            height: '140px'
        }, 250);
    });
    $(this).dequeue("test");
})
+3
source share
1 answer

, , "test", , , fx ( ), "test" .

.dequeue()... fx , , . :

  • $(this).clearQueue("test"); -
  • $(this).queue("test", ...); - test
  • $(this).animate({... }); - fx
  • $(this).dequeue("test"); - test, , .animate() .
+1

Source: https://habr.com/ru/post/1775927/


All Articles