简体   繁体   English

使用jQuery更改口述故事情节的文本颜色?

[英]Changing Articulate Storyline text color using jquery?

Here is the code that I'm using to animate a text in Storyline using jQuery: 这是我使用jQuery在Storyline中为文本设置动画的代码:

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... 但是当我尝试使用jQuery更改文本的颜色时,没有任何反应...

if I can use jQuery to animate a text why I can't use it to change the color of it? 如果我可以使用jQuery为文本设置动画,为什么不能使用它来更改其颜色?

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');

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. 我可以猜测是SVG。通常,包含文本的svg也具有<text></text>并且svg不使用color而是fill CSS。

Changing to this should work: 更改为此应该工作:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM