I found a really nice rainbow text animation that I like:
https://github.com/xoxco/Rainbow-Text
I am trying to apply the effects of this to all text inside a class.
<span class="rainbow">some text here...</span>
The problem is that if I have two different pieces of text on the page:
<span class="rainbow">Text #1</span>
<span class="rainbow">Text #2</span>
The effect of the rainbow extends to both parts of the text, but the text content of each range changes to Text #2.
The text is not static on the page, so I cannot use it id.
Is there a way to change the class (or id) of each rainbow text to rainbow-1, rainbow-2etc. and execute javascript code on each pass independently? Maybe a loop that iterates over an id starting with rainbow-, and applies the effect to it independently?
source
share