我通过循环分配数据值,但是当我检查每个元素时,没有找到任何属性......任何人纠正了我的功能?
var paper = new Raphael('slideContainer', 930, 420);
//mainpage circles;-
var mainPageCircle = {
circles :{
cR:{color:'#730000',text:'Content'},
cB:{color:'#004f74',text:'Consulting'},
cG:{color:'#146c00',text:'Commerce'}
},
radious:100,
stroke:10,
strokeColor:'#fff',
opacity:0.7
}
$.each(mainCrProp.circles, function (n) {
pCircles = paper.circle(
n==='cR' ? (paperWidth/2) - mainCrProp.radious/2 :
n==='cB' ? paper.getById('cR').attr('cx') + mainCrProp.radious : (paperWidth/2),
n==='cR' ? (paperHeight/2) - mainCrProp.radious/2 :
n==='cB' ? paper.getById('cR').attr('cy') :
n==='cG' ? paper.getById('cR').attr('cy') + mainCrProp.radious : paperHeight/2,
mainCrProp.radious)
.attr({fill:this.color,'stroke-width':mainCrProp.stroke,stroke:mainCrProp.strokeColor,opacity:mainCrProp.opacity})
.data('dClass',(i+'Group'))//i am setting my data..
.id = n;
//
pText = paper.text( n==='cR' ? (paperWidth/2) - mainCrProp.radious:
n==='cB' ? paper.getById('cR').attr('cx') + mainCrProp.radious*1.5 : (paperWidth/2),
n==='cR' ? (paperHeight/2) - mainCrProp.radious/2 :
n==='cB' ? paper.getById('cR').attr('cy') :
n==='cG' ? paper.getById('cR').attr('cy') + mainCrProp.radious*1.5 : paperHeight/2,
this.text)
.data('dClass',(i+'Group'))//i am setting my data
.id = n+'text';
pGroup[i] = paper.set(pCircles,pText);
i++;
} )
paper.forEach(function (el) {
console.log(el.data('dClass'));// i am not getting any data value..
} )