Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript alternating text with jQuery Re: alternating text with jQuery

#74170
cybershot
Participant

it’s easy

function colorChange() {
$('span').text('blue');
$( 'span' ).delay(2000).fadeOut(1000,function(){
$(this).text('red');
}).fadeIn(1000).delay(2000).fadeOut(1000,function(){
$(this).text('green');
}).fadeIn(1000);
}

then you call it the way jfreehill shows


$(document).ready(function(){

var colorLooper = setInterval(function() {
colorChange();
}, 6000);
});

untested. play with it to get it working. Look up functions in jquery.