I'm having problems combining .delay with .addClass using jQuery. My goal is to have a slight delay before the class is added, but my approach doesn't seem to solve the issue. The class is added immediately even when I specify a delay. If anyone could suggest a solution for this, or explain to me what I'm doing incorrect…I'd be ever so thankful.
ALSO…I've added the .stop() before the animation attempting to prevent the next animation from firing until the current is complete. For whatever reason (mostly my lack of knowledge on the subject) this fails to work. Am I writing it properly?
Howdy,
I'm having problems combining .delay with .addClass using jQuery. My goal is to have a slight delay before the class is added, but my approach doesn't seem to solve the issue. The class is added immediately even when I specify a delay. If anyone could suggest a solution for this, or explain to me what I'm doing incorrect…I'd be ever so thankful.
Here is a code sample:
ALSO…I've added the .stop() before the animation attempting to prevent the next animation from firing until the current is complete. For whatever reason (mostly my lack of knowledge on the subject) this fails to work. Am I writing it properly?
A quick Google gave me this.
In short, use setTimeout.
@eldeeff
Great…thanks for suggestion.
Or: