Is there a way to transform code like this:
$("div").css({
"top": var1,
"height": var2,
etc.
});
Into something like this:
var dir = "top";
var length = "height";
$("div").css({
dir: var1,
length: var2,
etc.
});
Currently, I can only make it work by declaring each line separately, for example:
$("div").css(dir, var1);
$("div").css(length, var2);
$("div").css(etc.);
Anyone have alternative suggestions? I'm trying to create a universal variable for direction so I can easily rotate my module 90 degrees (left to right or top to bottom).