Change animation direction with variable in jQuery
<p>I searched this topics and i find some responses but they didnt seem to work for my code. Part of my code is this:</p>

<pre><code>var direction = "left";
var speedvar = 3000;
var container_w = parseInt($("#lr-s").width());

$("#lr-s ul#"+number).animate({"left": "-="+container_w}, speedvar, "linear", function() {});
</code></pre>

<p>If i set the direction manually it works ok, but when i do this:</p>

<pre><code>$("#lr-s ul#"+number).animate({direction: "-="+container_w}, speedvar, "linear", function() {});
</code></pre>

<p>Putting the "direction" variable dosnt seem to work. I need that the direction changes ("left, "right", "bottom", "top") so changing the symbol -= for += dosnt fit for me. I also tried:</p>

<pre><code>var settings = {};
settings[direction] = container_w;
$("#lr-s ul#"+number).animate(settings, speedvar, "linear", function() {});
</code></pre>

<p>and</p>

<pre><code>var settings = {"left": "-="+container_w};
$("#lr-s ul#"+number).animate(settings, speedvar, "linear", function() {});
</code></pre>

<p>Nothing worked with variables for the direction. Changin the direction manually works ok but i want to set a variable to simplify changing the direction for the user of the plugin. Help please. Thanks.</p>
