I'm getting some unpredictable mishaps with my script and I'm beginning to think it might have something to do with the animation I use.
I have one element with the click() event attached that triggers an animation. Something like
$(el).click(function() {
$(this).animate({some properies}, 500);
});
Let's say we extend this a little bit
$(el).click(function() {
$(this).stop(true, true);
fancyFunction(this);
$(this).animate({some properies}, 500);
});
I have now added a call to fancyFunction and the important thing is that I stop ongoing animation on the object (in case I double click for example). Also for the record fancyFunction() MUST be sure that no animation is running on the element.
I think that this might be the problem I have. Can you rest assured that stop() is complete before next line is called, in this case fancyFunction(), or will fancyFunction fire immediately after stop() has started, but not necessarily completed? If it behaves like other functions in the animation categories I guess no.
If this might be the problem, what solutions do you have?