2016-02-24 53 views
-1

jQuery插件頁面:https://github.com/peachananr/simple-text-rotatorjQuery插件:文本旋轉,改變顏色

我的小提琴:https://jsfiddle.net/jzhang172/8msf91wa/

請檢查我的外部小提琴,不是這裏的代碼,它不是在這裏出於某種原因的工作。

我想改變的一些字的顏色和我的自定義CSS,但不能找出如何:

$(document).ready(function(){ 
 
$(".rotate2").textrotator({ 
 
    animation: "dissolve", // You can pick the way it animates when rotating through words. Options are dissolve (default), fade, flip, flipUp, flipCube, flipCubeUp and spin. 
 
    separator: ",", // If you don't want commas to be the separator, you can define a new separator (|, &, * etc.) by yourself using this field. 
 
    speed: 2000 // How many milliseconds until the next word show. 
 
}); 
 
});
span.color1{ 
 
    color:red !important; 
 
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/simple-text-rotator/1.0.0/simpletextrotator.css" rel="stylesheet"/> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/simple-text-rotator/1.0.0/jquery.simple-text-rotator.js"></script> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
Hey, <span class="rotate2">Friend, <span class="color1">sir</span>, ma'am</span>

回答

1

正如您在source看到該插件的用途$.text().rotate2元素轉換爲文本字符串,因此您的所有顏色標記都將被靜默丟棄。 似乎沒有可能將樣式應用於單個條目。