This jQuery code loops through rows in a table and highlights each row as it goes. I have a stop button that sets a variable to false.
I know that I can break out of the .each loop by using return false;
, but I want it to break out from within the queue.
How can I do this if the var
is false
?
$('.js-channel-notes tr').each(function(i) {
$(this).delay((i++) * 160).queue(function() {
$('.channel-row-highlight').removeClass('channel-row-highlight');
$(this).addClass('channel-row-highlight').clearQueue();
});
});