I have the following code:
<div class="drawing1"></div>
<button id="start">Begin</button>
When the user clicks on the Button, the class assigned to the DIV element should change from drawing1 to drawing5, passing through each drawing in between (There are 5 drawings in total). It should also have a delay() of about 500. My first thought was:
$('div').delay(800).toggleClass('drawing1 drawing2');
Which works but when I try to add the rest of the drawings (Tried several methods using toggleclass and add/remove class), it either jumps to the last one or only does the second one.
How can I set this up so I can go from one drawing class to the next, going through each one, one by one with the delay applied for each.
delay()only works with a queue, specifically the effects queue or a custom queue. In this case, the delay will not apply, which is why you are seeing it jump to the last class. You need to usesetTimeout()instead.