$(this).dequeue(); vs next();

前端 未结 1 1260
刺人心
刺人心 2021-02-07 15:13

Is there any difference if I do:

$queue.queue(function(next){
   //...
   next();
}).queue(function(next){
   //...
   next();
});

versus

1条回答
  •  囚心锁ツ
    2021-02-07 16:05

    There isn't much difference. next() simply calls .dequeue() with variables held in a closure (source):

    var ...,
        next = function () {
            jQuery.dequeue( elem, type );
        };
    

    I'd say to use next() as it just means less you have to do, since it already has what you need for .dequeue() -- the elements and queue name (or type).

    0 讨论(0)
提交回复
热议问题