我有路徑,這就是它的外觀在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