我完全不知道怎么问这个问题。如果有人不明白这一点,我很抱歉。事情是,我有对象,我正在循环使用each function
,当我得到子对象(内部对象)时,我想分配回相同each function
的对象,有什么好主意?
看看我的问题:
我的对象:
var xploreMaps = {
radious:55,
stroke:5,strokeColor:'#fff',
opacity:0.8,fontSize:13,line:10,
cGtext:{
length:5,
lineColor:'#579549',
prop:{
0:{link:'catalogs .html',color:'#7a5967',text:'Catalogs',
subLink:{0:{link:'SEO_SMM.html',color:'#4e4b69',text:'SEO/SMM',align:'top'},1:{link:'site_analytics.html',color:'#545454',text:'Site analytics',align:'btm'}}},
1:{link:'socialmedia.html',color:'#1e9ead',text:'Innovation'},
2:{link:'loyalty .html',color:'#8fad34',text:'Ideation'},
3:{link:'promotions .html',color:'#563b64',text:'Promotions'},
4:{link:'implementations.html',color:'#2c6566',text:'Implementations',
subLink:{0:{link:'integrating.html',color:'#4c4a66',text:'Integrating',align:'top'},1:{link:'payment.html',color:'#948048',text:'Payment',align:'btm'}}}
}
}
}
var object = xploreMaps[id].prop || 'i need subLink';
我的功能:
$.each(object, function (n,d) {
var Color = this.color,link = this.link,text=this.text,**subLink** = this.subLink || '';
// if the sublink there, i need to put back to each, and do the same stuff, what i do for it's parent object.
var myTimeout = setTimeout(function(){
redSubCircles.push(paper.path("M"+x +" "+y)
.attr({stroke:brdColor})
.animate({path:"M"+(x-((stroke/2)+(n*((radious*2)+stroke+line)))) +" "+y+'l'+(-line)+' 0'},1000,
function(){
var c = paper.circle((x-(radious+stroke+line) - n*((radious*2)+stroke+line)),y,radious)
.attr({
stroke:strokeCl,
'stroke-width':stroke,
opacity:opacity,
fill:Color,
href:link
});
var p = paper.text((x-(radious+stroke+line) - n*((radious*2)+stroke+line)),y,text)
.attr({fill:strokeCl,'font-size':fSize,href:link})
redSubCircles.push(c,p)//push to set;-
}));
},1000*n)
} )
如果我错了,我很抱歉。请告诉我正确的方法。