Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Jquery操作文本阴影_Jquery_Css - Fatal编程技术网

使用Jquery操作文本阴影

使用Jquery操作文本阴影,jquery,css,Jquery,Css,我想操纵特定于阴影的文本 我试过这个 this.css("text-shadow", '#FFD800 1px 1px 0'); 以及它的工作原理。但我想做更多 我正试图: sh=""; for (i = 1; i < 14; i++) { sh += ',#FFD800 '+i+'px '+i+'px 0'; } this.css("text-shadow", sh); sh=”“; 对于(i=1;i

我想操纵特定于阴影的文本

我试过这个

this.css("text-shadow", '#FFD800 1px 1px 0');
以及它的工作原理。但我想做更多

我正试图:

sh="";
for (i = 1; i < 14; i++) {
    sh += ',#FFD800 '+i+'px '+i+'px 0';
}           

this.css("text-shadow", sh);
sh=”“;
对于(i=1;i<14;i++){
sh+=',#FFD800'+i+'px'+i+'px 0';
}           
css(“文本阴影”,sh);
这不是工作。我怎样才能去上班? 谢谢。

只能应用于
jQuery
对象,所以请更改

this.css("text-shadow", sh);

另外,在样式值的开头还有一个额外的
,以避免使用下面的内容

var sh=[];
对于(i=1;i<14;i++){
sh.push(“#FFD800”+i+“px”+i+“px 0”);
}
$(this.css(“文本阴影”,sh.join(','))
只能应用于
jQuery
对象,因此更改

this.css("text-shadow", sh);

另外,在样式值的开头还有一个额外的
,以避免使用下面的内容

var sh=[];
对于(i=1;i<14;i++){
sh.push(“#FFD800”+i+“px”+i+“px 0”);
}
$(this.css(“文本阴影”,sh.join(','))
更改此行:

 this.css("text-shadow", sh);

.css是一个jQuery函数,它在适当的选择器上工作

演示

更改此行:

 this.css("text-shadow", sh);

.css是一个jQuery函数,它在适当的选择器上工作


Demo

您试图在
sh
中放入多个值。你到底想做什么?你想为文本阴影设置一些随机值吗?我想用一种简单的方式模拟3D视图。因为我必须不使用任何插件。您是否尝试过使用文本阴影的硬代码值,而不是使用循环生成它。请尝试一下,让我知道你想要使用的确切值。发布一个JSFIDLE链接,以便我们能够更好地帮助您。您正在尝试在
sh
中输入多个值。你到底想做什么?你想为文本阴影设置一些随机值吗?我想用一种简单的方式模拟3D视图。因为我必须不使用任何插件。您是否尝试过使用文本阴影的硬代码值,而不是使用循环生成它。请尝试一下,让我知道你想要使用的确切值。发布一个JSFIDLE链接,以便我们能以更好的方式帮助您。@user2729439:乐意帮助:)@user2729439:乐意帮助:)