[jQuery] Animation error and next level help
Guys,
I am working on a plugin and having two issues:
url in quesiton; <a href="http://www.benjaminsterling.com/experiments/neurosesgalore/">http://www.benjaminsterling.com/experiments/neurosesgalore/</a>
js file in question:
<a href="http://www.benjaminsterling.com/experiments/neurosesgalore/common/js/i.js">http://www.benjaminsterling.com/experiments/neurosesgalore/common/js/i.js</a><br clear="all">
<span style="font-weight: bold;">Question 1:
</span>
As it stands now, I have below in a click event:
<span style="font-weight: bold;"> var $this = $(this);</span><br style="font-weight: bold;"><span style="font-weight: bold;">
</span><br style="font-weight: bold;"><span style="font-weight: bold;"> $this.animate({'left':-208,'top':15},</span><br style="font-weight: bold;"><span style="font-weight: bold;">
s.speed,</span><br style="font-weight: bold;"><span style="font-weight: bold;"> function(){</span><br style="font-weight: bold;"><span style="font-weight: bold;"> var cur =
elArray.shift();</span><br style="font-weight: bold;"><span style="font-weight: bold;"> elArray.push(cur);</span><br style="font-weight: bold;"><span style="font-weight: bold;"> for ( var i = 0; i <
elArray.length; i++ ) {</span><br style="font-weight: bold;"><span style="font-weight: bold;"> $(elArray[i]).css('z-index', String(elArray.length-i));</span><br style="font-weight: bold;">
<span style="font-weight: bold;"> };</span><br style="font-weight: bold;"><span style="font-weight: bold;"> </span><br style="font-weight: bold;"><span style="font-weight: bold;">
$this.animate({</span><br style="font-weight: bold;"><span style="font-weight: bold;"> 'left':0,</span><br style="font-weight: bold;"><span style="font-weight: bold;">
'top':0</span><br style="font-weight: bold;"><span style="font-weight: bold;"> },s.speed);</span><br style="font-weight: bold;"><span style="font-weight: bold;">
});</span>
And it works in Firefox, but in IE6 I am getting an "Invalid argument" error, which I had broken done to being this part of the code:
<span style="font-weight: bold;">
$this.animate({'left':-208,'top':15},</span>
I changed to:
<span style="font-weight: bold;"> $this.animate({'left':'-208','top':'15'},
</span>
and still the same error.
<span style="font-weight: bold;">Question 2:
</span><span></span>I want to make the above code more dynamic, I am allowing for a option to be passed in to change the direction of the animation, but when I do:
<span style="font-weight: bold;"> newDirection = 'left';</span>
<span style="font-weight: bold;"> $this.animate({</span><span style="font-weight: bold;">
newDirection</span><span style="font-weight: bold;">:-208,'top':15},</span>
It left animation does not work at all.
Any help and direction would be very helpful.
--
Benjamin Sterling
<a href="http://www.KenzoMedia.com">
http://www.KenzoMedia.com</a>
<a href="http://www.KenzoHosting.com">http://www.KenzoHosting.com</a>