我有路径,这就是它的外观在SVG如何在js中设置svg路径样式?
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 117.14283,292.36218 c 6.4302,40.00204 17.7957,72.08138 42.8572,97.14285 41.9864,41.98645 170.1489,-58.42248 108.5714,-120 -34.4011,-34.4011 -81.0249,123.66456 -65.7143,154.28572 20.1806,40.36118 166.194,14.76546 134.2857,-17.14286 -49.3132,-49.31326 -75.8868,85.36926 -60,117.14286 30.4479,60.89583 115.0776,-13.49389 97.1429,-31.42857 -3.4884,-3.48837 -113.508,91.67283 -22.8572,157.14285"
id="path3024"
inkscape:connector-curvature="0" />
我在js代码中选择这样
var path = svg.select("#" + options["pathid"]);
让我怎么改变行程,不透明度值?
这样不起作用=(
var path = svg.select("#" + options["pathid"])
.style('stroke', '#ff0000');
=============================== ========================
path.style("stroke-opacity", 0);
作品和
alert(path.style("stroke-opacity")); // returns 0,
但是当我在浏览器中启动SVG没有什么变化,和标签在代码中完全没有改变任何想法?
.style( '行程不透明度',0.5)例如不工作?你也可以检查[这里](http://stackoverflow.com/questions/15790948/modifying-svg-path-opacity-and-its-marker)。 – FernOfTheAndes
这种方式不起作用 – Orion
如果您创建小提琴,它将对所有人有所帮助。 – FernOfTheAndes