I have a container that has multiple elements wrapped in spans with a data attribute specifying the color in which it should fade to. I'd like to transition the color over 2 seconds, with a 0.5 seconds stagger between the elements. I may have 1 or I may have 100 elements to do.
I've been banging my head against the desk for a while and I feel like I'm missing something simple. The issue arises with trying to use the individually specified color for each element. If I just had the array of elements all going to the same color I've figured that out. But I can't get it where each color is a variable.
Each span is defined like: <span class="fadetext" data-fadeto="#ED8B00">
I've been through many iterations, but here is the most recent that does not work.
var tl = new TimelineLite();
nextSection.find('.fadetext').each(function(index) {
tl.staggerTo($(this), 2, {color: $(this).data('fadeto')}, 0.5);
});