I am trying to test a fadein and fadeout function that is looping arround, with different content
var next = null;
var outer = $('.twitter');
var current = outer.find('.twitterinner:first');
current.fadeIn();
function fade() {
if (current.next('div.twitterinner').length > 0) {
next = current.next('div.twitterinner');
} else {
next = outer.find('div.twitterinner:first');
}
current.fadeOut(500);
setTimeout(function(){
next.FadeIn(500);
},1000);
// next.fadeIn(500);
current = next;
setTimeout(fade, 2000);
}
fade();
and the html
<div class="col-xs-12 col-md-12 padding twitter">
<div class="twitterinner">Jellyfish Webdesign was afgelopen weekend aanwezig bij #YoutopiaArtsFestifal in het #Lloydhotel in A'dam! De website hebben we gesponsord.<br></div>
<div class="twitterinner">Laat uw email adres achter via http://t.co/MHUXpcY1NE om op de hoogte te blijven van onze nieuwe website release. #Jellyfishux<br></div>
<div class="twitterinner">Jellyfish Webdesign is vandaag officieel live gegaan! Voor meer informatie bezoek onze website, http://t.co/MHUXpcY1NE #jellyfishux<br></div>
</div>
If i remove the setTimeout after the startup, it runs just fine (and i include again the fadeIn) but once I add the setTimeout with the fadein function in it, it stops working. I cant seem to find where I go wrong. Can anyone point me in the right direction?
setTimeoutworks a-synch-ron-ous-ly. Think about that:)FadeIn != fadeIn- jsfiddle.net/arunpjohny/poqga8w0/1setInterval.