It is hard for me to explain so I will just demonstrate what I am trying to do:
This work fine:
$(this).animate({ top: 200 }, 500);
I’m trying to replace the ‘top’ value by a variable
like this:
var x = 'top';
if (condition) { x = 'left'; }
$(this).animate({ x: 200 }, 500);
But this fail.
You can try this.