我有一个svg对象,我希望它的样式不同: a)第一次加载图像(填充:白色) b)当鼠标悬停在物体上时(填充:黄色) c)当鼠标离开对象时(填充:蓝色)
我似乎无法找到如何分离a)和c)状态。
提前致谢
答案 0 :(得分:1)
我对stackoverflow很新,所以这可能不是一个好的答案,但我会尝试正确回答这个问题。
我认为您应该尝试使用jQuery,您要做的是在CSS中设置起始值, Fill:White 。然后在jQuery中你会
$("YOUR SELECTOR").hover(function(){
$(this).css("background", "yellow");
}, function(){
$(this).css("background", "blue");
});
有关此问题的更多说明,请转到:https://www.pluginsforckeditor.com/Tutorials/86/Upload-files-with-CKEditor
希望这可以帮助你,我是stackoverflow的新人,所以请善待;)
干杯
答案 1 :(得分:0)
这很容易。您可以使用mouseleave事件来标识元素已悬停一次,然后使用它来更改元素的背景。
以下是一些代码:
jQuery('#square').mouseleave(function() {
jQuery(this).removeClass('red')
jQuery(this).addClass('blue');
});
#square{
width:100px;
height: 100px;
}
.red {
background:red;
}
#square:hover{
background:yellow;
}
.blue {
background:blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="square" class="red"></div>