0
'SVG'要素に問題がありますが、attr()メソッドを使用して 'svg'円要素にクラスを追加しようとしています働いていない。SVG要素のaddClass()とAttr()でクラスが追加されていません
**Here is the some piece of code: **
r = new ScaleRaphael('lg-map', config.mapWidth, config.mapHeight),
attributes = {
fill: '#d9d9d9',
cursor: 'crosshair',
stroke: config.strokeColor,
'stroke-width': 1,
'stroke-linejoin': 'round',
'font-family': 'Verdana',
'font-size': '19px',
'font-weight': 'bold'
},
var pinattrs = {
'cursor': 'pointer',
'fill':pins[i].color,
'stroke':config.strokeColor,
'id': pinId,
'class':'smallCircle'
};
var pin = r.circle(pins[i].xPos, pins[i].yPos, config.pinSize).attr(pinattrs);
そして結果は次のとおりです。
<circle cx="425" cy="425" r="10" fill="#737373" stroke="#f2f2f2" id="2" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); cursor: pointer;"></circle>
私もaddClass()メソッドを試してみましたが、同じ結果を持っています。
おかげ
あなたは、コンテキストのためのより多くのコードを提供することができますか? 'r.circle'とは何ですか? –
addClassはSVG要素ではうまく動作しません。 attr()はそうだけど、r.circleはどこから来ますか? –
http://stackoverflow.com/questions/8638621/jquery-svg-why-cant-i-addclass – Khaleel