简而言之 - 我试图通过将鼠标悬停在左侧的标题之一上来更改路径中的笔划不透明度(您会看到“presidio”标题有一个链接) 到目前为止我见过的 JQuery/javascript 答案都不起作用。
我尝试过的最新片段是:
d3.select('.presidio').on('mouseover', function(){
console.log('hey!');
var object = document.getElementById("presidio");
object.setAttribute("stroke-opacity", 1);
});
svg 很大,因此将其粘贴到此处需要一百万年的时间才能阅读。但如果你想检查这里的 svg 元素:http://www.petegetscreative.com/hoods/hoods.html
最佳答案
要更改 id 为“presidio”的元素的不透明度:
d3.select('#presidio').style("stroke-opacity", "1");
为所有具有“presidio”类的元素添加鼠标悬停效果
d3.selectAll('.presidio').on('mouseover', function(){
d3.select(this).style("stroke-opacity", "1"); })
关于javascript - 更改 <svg> 对象路径的笔划不透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20449609/