1

Here is the code that I'm using to animate a text in Storyline using jQuery:

var item = $('[aria-label="myText"] svg')

$(item).toggle( "puff" );

this code is working.

But when I tried to change the color of the text using jQuery nothing happens...

if I can use jQuery to animate a text why I can't use it to change the color of it?

Here are the codes I've tried: (Am I missing something?!)

var item = $('[aria-label="spinner"] svg')

$(item).attr('style','color: green;');

and also :

var item = $('[aria-label="spinner"] svg')

$(item).css('color', 'red');
Sara Ree
  • 3,417
  • 12
  • 48
  • 1
    Michael is right underneath. SVGs are basically code, if you double click on one of them in a text editor you're able to see the code. You'll figure out what does what when you do that, but Michael is also right, it's probably the 'fill' you need to change. – Jabberwocky May 23 '19 at 16:59
  • @Jabberwocky Thanks, Michael was right .... – Sara Ree May 23 '19 at 17:03

1 Answers1

2

I can guess an SVG.. normally an svg containing text has also a <text></text> and svg are not using color but fill instead in the CSS.

Changing to this should work:

var item = $('[aria-label="spinner"] svg text')

$(item).css('fill', 'red');