JQuery: fade div in and out multiple times?

If you are using the latest version of jQuery (1.4 as of this writing), you can specify such a short cycle with straight function calls: $("#notification"). FadeIn(500). FadeOut(500).

Delay(500) . FadeIn(500). FadeOut(500).

Delay(500) . FadeIn(500). FadeOut(500) delay was introduced in jQuery 1.4 If the repetition bothers you, you could make it a plugin: $.fn.

Pulsate = function( number, time){ for(var I = 0; I = number - 1) this. Delay(time); } return this; } It could then be used like this: $("#notification"). Pulsate( 3, 500 ).

If you are using the latest version of jQuery (1.4 as of this writing), you can specify such a short cycle with straight function calls: $("#notification"). FadeIn(500). FadeOut(500).

Delay(500) . FadeIn(500). FadeOut(500).

Delay(500) . FadeIn(500). FadeOut(500); delay was introduced in jQuery 1.4.If the repetition bothers you, you could make it a plugin: $.fn.

Pulsate = function( number, time){ for(var I = 0; I FadeOut(time); if(i! = number - 1) this. Delay(time); } return this; } It could then be used like this: $("#notification").

Pulsate( 3, 500 ).

Well, I spent all of 3 minutes learning about actual js structure (instead of just relying entirely on jQuery), and I decided to wrap it in a while loop that counts to 3. But, since you gave an equally good solution, you get the credit. Thanks!

– Raggedtoad Jan 19 '10 at 15:42 While I have the attention of a js pro like you, could you also recommend a good way to start with the text in the div having one color, then after the animations are done, it changes to a different color? – Raggedtoad Jan 19 '10 at 15:57 If you want to animate it, look into the jQuery Color plugin. Otherwise, change your last call to something like this: .

FadeIn(500, function(){ $(this). Css('color', 'red') }); – Doug Neiner Jan 19 '10 at 17:16.

I think it would be better to use it in callback. Create recursive function with limit of fading. Animation(max, total) { if (total Animate(..., animation(max, total + 1)); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions