var property = 'margin-left'
var obj = {}
obj[property] = '100px'

this will result in an object like: {'margin-left': '100px'}

using {property: '100px'} yields in... {property: '100px'}.
So you can't use variables using the object notation, you have to use the
square brackets notation for that, obj[variable] = '...'

Once that's done, you can pass it into .morph(obj) or whatever.

On Sun, Mar 25, 2012 at 4:24 PM, hamburger <[email protected]> wrote:

> Sorry Matthew for my bad explanation and thanks for your examples.
> (thats not what I tried to do)
>
> I would like to make my i.tween (here Fx.Morph) more flexibel. For
> that I would like to change the ff-variable in .start({ff: ...
> dynamically (change between margin-right and margin-left)
> If I substitute ff direkt with 'margin-right' it works.
> If I do it like ff = "margin-right"; and bring this to .start({ ff:
> [0], ... it will be ignored.
>
> I do not understand why.
>
> thx for an hint in advance.
>
> PS: In my example the effect is not to see in html. (I just copied a
> code-snipe) Please look at your console to see that the margin-right
> is not changing.
>
>

Reply via email to