我正在使用 Raphaeljs 绘制地图,并且我在一组路径中设置了路径,因为我希望它们都具有相同的属性并且一切都很好,但是现在我想为每条路径设置一个 id,我做到了但是属性丢失了,所以我的问题是......有没有办法在具有 set 属性的集合内有一个 path.id ?谢谢
这是文件http://jsfiddle.net/tLSpv/2/
var paper = Raphael(0,0,540, 615);
var newmexico = paper.set();
newmexico.push(
paper.path("M343.249,11.503l-1.658,3.554l-0.474,16.822c0,0-3.554-0.711-5.449-0.711 s-5.686,3.554-5.449,4.265c0.237,0.711-1.895,13.268-1.895,14.215s3.554,4.502,3.317,5.449c-0.237,0.948-0.711,3.554-0.474,4.502 c0.237,0.948,0.711,7.345,0.474,9.477c-0.237,2.132,0.948,11.846-1.658,13.268h42.883v5.449h38.855h37.197V73.103l1.303-1.303V1.239 L340.643,1.18v4.4L343.249,11.503z").node.id = 'colfax';
).attr({
fill: '#F7F0EA',
stroke: '#006599',
'stroke-width': 1,
cursor: 'pointer'
})
.hover(function () {
this.animate({fill: '#006599'}, 300);
},
function () {
this.animate({fill: '#F7F0EA'}, 300)
}
);