gpt4 book ai didi

javascript - 改变 对象路径的描边不透明度

转载 作者:行者123 更新时间:2023-11-29 18:19:12 24 4
gpt4 key购买 nike

简而言之 - 我试图通过将鼠标悬停在左侧的一个标题上来更改路径中的笔触不透明度(您会看到“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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com