我试图渲染一个不同的颜色的SVG,我有悬停,但我找不出最好的方法来做它。
当我查找这个问题时,它告诉我使用fill:{color},但我无法让它工作。我尝试创建两种不同的SVG颜色,一种是我想要的颜色(CancelBlack),另一种是我在悬停时想要的颜色(CancelBlue)。然后我试着这样做:
.cancelBlack:hover{
display:none;
}
.cancelBlue{
display: none;
}
.cancelBlue:hover{
display:flex;
}
//heres how im calling it in react
&
正如标题所说,我正在处理的一个页面在页面加载时触发了一个悬停事件。
Javascript
// Random Color Function
var repeater;
function rnd_color(){
document.getElementById('logo').style.fill = '#'+Math.floor(Math.random()*16777215).toString(16);
repeater = setTimeout( function(){ rnd_color(el) }, 100);
};
// Logo Ho