I have a script to reset game pieces, but I cannot get the variable to call the other variable to get the end value.
Here are the variables that contain original position, I need the value of these in my function:
red_1_x = $('#red_1').css('left');
red_1_y = $('#red_1').css('top');
Here is my function that calls the animation function:
$('.piece').mouseover(function(e) {
var id = $(this).attr('id');
resetGroundShoe(id);
});
$(this).attr('id') is for example: red_1
And here is the animation function:
function resetPiece(id){
if(!id){
alert('no id');
}
else{
x = id+'_x';
y = id+'_y';
gotoX = x;
gotoY = y;
$('#'+id).animate({left: x}, 250, function(){
$('#'+id).animate({left: y}, 250);
});
}
}
For some reason gotoX and gotoY are not the numeric value of red_1_x and red_1_y