I am having problems using multiple queues in jQuery. Consider the following example:
$('#example').click(function() {
$(this).delay(1000, 'fx2').queue('fx2', function() {
alert('here');
});
});
The alert never fires. Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It seems when calling
delay(or any other animations for that matter) on a custom queue you need to also set that queue in motion first using.dequeue()jsbin preview
Note that the callback on
queuereceives a function as its first argument. This is the function you want to call whenever your “animation” is finished so that the next item in the queue can execute.The jQuery code handles ‘auto-starting’ the
fxqueue in the$.fn.queue()function: