Hi
I'm using jQuery's animate function like this:
var css1 = {
display: "block",
marginTop: 20
};
var direction = "marginTop";
$(element).animate(css1, 150, 'swing');
Notice the marginTop
property above. Well I want to replace that with the direction variable, but it doesn't work for some reason. Does anyone know why?
Later edit: Basically I want to replace:
var css1 = {
display: "block",
marginTop: 20
};
with
var css1 = {
display: "block",
direction: 20
};
The problem is that jQuery doesn't seem to recognize "direction" as the "marginTop" property