JQuery fadeIn(), fadeOut() 2 texts?

Let's say that your html is like this: 1 2 3 You can do something like: var faderIndex = 0, //to keep track faders = $('. Fadey'); //cache, so we won't have to walk the dom every time function nextFade() { //fade out element over 1000 milliseconds, after which call a function $(fadersfaderIndex). FadeOut(1000, function() { //increase the index and do a check, so we won't overflow faderIndex++; if (faderIndex >= faders.

Length) faderIndex = 0; //fade in the next element, after which call yourself infinitely $(fadersfaderIndex). FadeIn(1000, nextFade); }); } //get the ball rolling nextFade(); Live example: http://jsfiddle.net/gpQYW.

It's good. I like the 2 examples. Thanks guys!

– vladchooo May 17 at 16:28.

You use the callback of the .fadeOut() function to change the HTML and then fade it in, as there will be flicker in the middle: $('#foo'). FadeOut(500, function() { $(this). Html('Bar'); $(this).

FadeIn(500); }).

Thanks previously! – vladchooo May 17 at 15:48 That's in the serverside, not JavaScript. A PHP script, let's say, does that and jQuery animates it.

– Blender May 17 at 15:49 I don't need it dynamic I want 5 sentences in html like in the Apple website in tag see the source code... – vladchooo May 17 at 16:00 That's generated via server. But I'll do a static one too. – Blender May 17 at 16:02 Please do it!

Thanks! – vladchooo May 17 at 16:08.

Consider following HTML: Test Google. Com Microsoft. Com Stackoverflow.Com Wired.

Com and the script: $(function () { // set first $('. RotateText'). Html($('.

RotateArray a'). Eq(0)); // enter loop rotateText(); }); function rotateText() { var count = $('. RotateArray a').

Length; var I = 0; var loopArr = $('. RotateArray a'); var rotationElm = $('. RotateText'); window.

SetInterval(function () { rotationElm . FadeOut(400) . Queue(function () { $(this).

Html('' + loopArr. Eq(i).text() + ''); if (++i == count) I = 0; $(this).dequeue(); }) . FadeIn(400) ; }, 4000); }.

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