I want to create a delay between each element, it has to be 500ms. However there is already an initial delay at present. I have a solution, but it looks messy and want it leaner than what I have at present.
Currently I have added 1500ms (starting delay) for both. On the second element I have added 500ms (second element delay) to the earlier value to achieve the end result.
I have this code:
if ( $('#brand').length ){
setTimeout(function(){
$('#elementA', $brand__service).toggleClass('superman--returns');
}, 1500);
setTimeout(function(){
$('#elementB', $brand__service).toggleClass('birdman--helps');
}, 2000);
}
Any ideas how to achieve better practise? I have tried .promise() / .delay() / .done(). To no avail.