perform animations -> when complete, wait for a click to perform another action, animation repeats. Gurr.
Here is my code snipit
- $wrapper = $("div.box");
$wrapper.each(function ( i) {
var div = $(this);
setTimeout(function () {
div.fadeIn(800);
}, i * 800)
}).stop();
$("a.imp").click(function(event){$(this).parents("div").css('z-index','2');return false;});
The loop with the setTimeout function works fine.
And when run alone, the click function on the link works fine.
But when I click on anchor tag, it runs the loop animation again.
Any sugestions?
I want the animation to run, then, when the user clicks on the link, I want that particular link to change it's css z-index property. The action triggereed by the link click works fine, but then animation runs again. How can I make it run only once?
I have tried stop(), stopPropagation(), stopImmediatePropagation(), finish(), and clearQueue(), in various places and in various combinations, but still the looped animation runs when I click the link.
I also tried getting mad at jQuery, but that didn't help.