I don't want the transition to stop if if encounter different class, I just want it not to toggle and keep iterating
You might want to use nextAll(tId).first()
/prevAll(tId).first()
to select the next to-be-toggled element: http://jsfiddle.net/35uNW/4/. .next()
does only look at the next sibling, and if that doesn't match your tId
selector, no element will be selected.
If you want to iterate the different-classed elements so that you wait for each one, but don't want to toggle it, you can use your if-condition but you must remove the tId
selector from the next()
/prev()
calls: http://jsfiddle.net/35uNW/3/.