我有一个小片的代码改变CSS内背景颜色
"spots": [{
"id": "rect-5115",
"type": "rect",
"x": 8,
"y": 52.7,
"width": 34.6,
"height": 16.7,
"default_style": {
"border_radius": 10,
"background_color": "#c0c0c0",
"background_opacity": 0.18943843984962405
},
"mouseover_style": {
"border_radius": 10,
"background_color": "#c0c0c0",
"background_opacity": 0.18943843984962405,
"fill": "#000000"
},
"tooltip_style": {
"auto_width": 1
我试图改变使用以下代码的背景色default_style。但是这是不工作,实际上ID: “矩形-5115”,在以下标记由2 BACKGROUND_COLOR的如在上面的代码中列出:
- default_style
- mouseover_style
我需要当点击Button_on时,更改default_style而不是mouseover_style的背景颜色。
$(document).ready(function(){
$('#Button_on').click(function(){
$('#rect-5115').css('background_color','#ff0000');
});
});
我尝试了几种方法来做到这一点,但它不工作,请你引导我通过正确的渠道。
感谢,
您好,感谢您的输入。 – user2095196