Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何在单击某个区域后阻止SVG颜色的更改?_Css_Svg - Fatal编程技术网

Css 如何在单击某个区域后阻止SVG颜色的更改?

Css 如何在单击某个区域后阻止SVG颜色的更改?,css,svg,Css,Svg,我有一个svg地图,我不希望在单击某个区域后颜色发生变化。如图所示。访问后,它看起来像一个超链接 .mapdiv { max-width: 45%; height: auto; margin: auto; width: auto; stroke: #a9a9a9!important; stroke-width: 2px; stroke-linejoin: round; fill: #5d6675;!important;} .mapdiv path { opacity: .85; cursor:

我有一个svg地图,我不希望在单击某个区域后颜色发生变化。如图所示。访问后,它看起来像一个超链接

.mapdiv {
max-width: 45%;
height: auto;
margin: auto;
width: auto;
stroke: #a9a9a9!important;
stroke-width: 2px;
stroke-linejoin: round;
fill: #5d6675;!important;}

.mapdiv path {
opacity: .85;
cursor: pointer;
-webkit-transition: all 150ms;
-moz-transition: all 150ms;
-o-transition: all 150ms;
transition: all 150ms; }

.mapdiv :hover {
stroke-width: 3px;
stroke-linejoin: round;
fill: #c9b394!important;
cursor: pointer; }

好的,在去掉所有坏习惯后,坏习惯是有原因的!重要信息:从我的CSS中,它得到了修复,不知道为什么或如何,但得到了修复。

使用javascript事件侦听器来更改填充,而不是CSS hover我尝试过JS,但没有运气=(“我尝试过…”-请提供tryI使用的JQuery,这里是我使用的$(document).ready(function(){$(“path”).hover(function(){$(this.CSS(“fill”),“#c9b394”)},function(){$(this.css(“fill”,“#5d6675”);});