Well, I don't know anything about the raphael library, but it would seem that you could wrap yours c.hoverin a self-start function to create a closure that references the correct value t.
(function( local_t ) {
c.hover(function (event) {
this.animate({r: 13}, 200);
local_t.show();
}, function (event) {
this.animate({r: 10}, 200);
local_t.hide();
});
})( t );
, hover, t t_local ( , ), ( ) .
, :
for(var i=0; i<feedData.length; i++){
var x = ((i+1)*diff);
var t = r.text(x, 120, feedData[i].title).hide();
var c = r.circle(x,150,10);
c.attr({fill: "red"});
c.attr({stroke: "red"});
c.attr({title: feedData[i].title});
(function( local_t ) {
c.hover(function (event) {
this.animate({r: 13}, 200);
local_t.show();
}, function (event) {
this.animate({r: 10}, 200);
local_t.hide();
});
})( t );
}
EDIT: for(), , Chrome, .
for(var i = 0; i < feedData.length; i++){
(function( local_i ) {
var x = ( ( local_i + 1) * diff );
var t = r.text(x, 120, feedData[ local_i ].title).hide();
var c = r.circle(x, 150, 10);
c.attr({fill: "red"});
c.attr({stroke: "red"});
c.attr({title: feedData[ local_i ].title});
c.hover(function (event) {
this.animate({r: 13}, 200);
local_t.show();
}, function (event) {
this.animate({r: 10}, 200);
local_t.hide();
});
})( i );
}