I am moving all CSS into inline JavaScript code in this example: jsfiddle. (the purpose is to test a plugin for svg manipulation, that doesn't like CSS from separate files)
I don't know how to transfer this line in CSS:
.link:hover {
stroke-opacity: .5;
}
to this line in JavaScript:
// add in the links
var link = svg.append("g").selectAll(".link")
.data(graph.links)
.enter()
.append("path")
.attr("class", "link")
.attr("d", path)
.style("fill", "none")
.style("stroke", "black")
.style("stroke-opacity", ".2")
.style("stroke-width", function (d) {
return Math.max(1, d.dy);
})
.sort(function (a, b) {
return b.dy - a.dy;
});
Could you help me? Thnx.