Calling values from a "dynamic" variable name
Hi,
sorry for the bad description, but I dont know how to name the problem, that's propably why I could'nt find a solution so far :(
The code looks like this:
-
fi_slide = 1;
- TweenMax.to($('#fi_slide_'+fi_slide), animationLength, {css:{top:(sf_position_out+(["fi_slide_"+fi_slide+"_margin_top"])*(-1))+"px"},ease:Expo.easeOut});
So what im tying to achive is to set the css value "top" to a specific value. The variable I am tying to call has the name
fi_slide_1_margin_top
But i am trying to call this variable dynamically, based on the previously defined variable "
fi_slide = 1"
Obviously, my approach "
["fi_slide_"+fi_slide+"_margin_top"]" does not work. It just gives the string
fi_slide_1_margin_top
as an output, but not the varibable value
Any solutions?