尝试使用 jQuery 设置 Text-Shadow 属性

trying to set Text-Shadow property using jQuery

本文关键字:设置 Text-Shadow 属性 jQuery      更新时间:2023-09-26

我正在尝试通过从用户那里获取值并使用JQuery更改它来设置文本阴影属性。我的代码如下

网页代码

<td width="13%">
H-Shadow::<input id="hshadow" onchange="setShadow();"/>
</td>
<td width="13%">
V-Shadow::<input id="vshadow" onchange="setShadow();"/>
</td>
<td width="12%">
Blur::<input id="blur" onchange="setShadow();"/>
</td>
<td width="12%">
Color::<input id="shadowcolor" class="color" onchange="setShadow();"/>
</td>

我的函数 setShadow 如下

function setShadow() {
var horShadow = document.getElementById('hshadow');
var verShadow = document.getElementById('vshadow');
var blurShadow = document.getElementById('blur');
var colorShadow = document.getElementById('shadowcolor');
$('.blue3d > textarea').css('textShadow', horShadow.value+"px "+verShadow.value+"px "+blurShadow.value+"px "+'#'+colorshadow.color);

}

也到第4个选择颜色..我正在使用JS颜色选择器。所以我需要在第 4 个中添加类=颜色..你可以在这里看到jscolor选择器

我哪里出错了?

使用 text-shadow 而不是 textShadow

  $('.blue3d > textarea').css('text-shadow', horShadow.value+"px "+verShadow.value+"px "+blurShadow.value+"px "+'#'+colorshadow.color);