i have two lines of javascript here, when the toggle function executes i want to delay before the find function happens.
$activeToggle.toggle("fast"); // i want this to run and then after 1250 millisec
$activeToggle.find(".anime").each(function (i,e){ // this code runs
alert(e.id);
});
I want to delay the second line of code to execute, because for some reason the alert is happening before the toggle action takes place, so their must a be way to delay the second line. thanks
Make use of the callback function. This ensures the toggle has finished executing before running the loop function you have.
This way you don’t need to delay. Your code will be ran immediately after the
toggle()function.