Skip to content

Instantly share code, notes, and snippets.

@yyolk
Created August 18, 2015 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yyolk/de1aa8b2f5ca3723af8a to your computer and use it in GitHub Desktop.
Save yyolk/de1aa8b2f5ca3723af8a to your computer and use it in GitHub Desktop.
/*
Joseph Chiocchi
Word Flash
Description:
Takes some text, and flashes one word at a time to the screen.
*/
var text = $("#ccontent").text();
var countmax;
var c=0;
function wordr(){
splt = text.split(" ");
countmax = splt.length;
if(c%2===0){
$('body, #back').css('background-color','white');
$('body, #back').css('color','black');
}else{
$('body, #back').css('background-color','black');
$('body, #back').css('color','white');
}
$("#wordflash").text(splt[c]);
c=c+1;
if (c>countmax)
c=0;
setTimeout("wordr()", 250);
}
wordr();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment