The passing of "next
" to the function was added in 1.4, I think more just as a way to make code more understandable. I think in the case you mentioned you should use next
because it's more readable. There are however situations when you have to use dequeue
.
The fx queue is a special case as it will automatically dequeue
the first element from the queue if it is empty and something is queued. Normally this is not the case.
Consider this:
$("#something").queue("myqueue", function(){/*dostuff*/});
This alone will never execute the function passed. A call to dequeue
is required to start the queue moving:
$("#something").queue("myqueue", function(){/*dostuff*/}).dequeue("myqueue");