0

我有一个类似于地图气泡的 highmaps 地图,并在其中定义了一个 id 设置为 icon6 的标记。我尝试使用 jquery 通过 id 访问此标记,但没有成功我已经尝试了所有方法,但没有任何效果。标记在 svg 中定义为,我可以使用填充在 css 中更改颜色,但不能在 javascript 中更改。这是我尝试在加载 js 代码之前加载 svg 文档的一些内容。

$(document).ready(function() {
    $('#icon6').setAttribute('fill', '#000000');
}); 

$(window).load(function() {
    $('#icon6').setAttribute('fill', '#000000');
});

和许多其他人。svg 文档的加载方式与 highmaps 加载它的方式相同。如本例所示:

http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/maps/demo/map-bubble/

4

1 回答 1

0

尝试这个:

$(document).ready(function() {
    $('#icon6').css({ fill: "#000000" });
});

或这个:

$(document).ready(function() {
    $('#icon6').attr('fill', '#000000');
});
于 2014-11-13T04:35:25.640 回答