0

The accepted answer on How to fade, animate and change text, word in title / sentence does a great job at replacing and animating words in a sentence.

How can I also change the color of those word(s), based on a predefined array of colors?

Community
  • 1
  • 1

1 Answers1

0

You could resolve it using CSS instead of Javascript with nth-child selector in this way:

[data-words] > span:nth-child(2){
  color: blue;
}

http://www.w3schools.com/cssreF/sel_nth-child.asp