>> providing something similiar with the tabs plugin. If you want to
>> use your own custom animation, you can pass in hashes exactly of the 
>> form the animate function expects.
>>
>> $(...).tabs({
>>      fxAnimate: [
>>          {height: 'show', opacity: 'show'},
>>          {height: 'hide', opacity: 'hide'}
>>      ]
>> });
>>   
> So the first array entry is used to display a tab, and the second to 
> hide it? Wouldn't it be be better to use it like this:
> $().tabs({
>     animateShow: { height: 'show', opacity: 'show'},
>     animateHide: { height: 'hide', opacity: 'hide'}
> });

Yes, the first entry is to show, the second is to hide a tab. At first I
thought it's not a good idea too decouple these options, because I
thought if you provide a custom animation you must provide both.

But after thinking about it, your way it's even more flexible. If you 
provide only an option for animateShow (I'm going to call it fxShow), no
animation will be used for hiding and vice versa. And it's much more 
readable too.

I'm going to change that. The tabs plugin will be found in the
repository soon by the way...


> This would enable plugin writes to simply point to the docs for animate, 
> instead of documenting their custom animation parser over and over again.

That was already my intention.


>> The problem was that the original object is modified so I have to copy 
>> the animate hash everytime and pass a copy to animate...
>>   
> Could you explain this some more? Why was the original object modified?

Yes, the object that is passed to animate was altered, all values were
converted to booleans which causes an error next time the animation was
executed with this object.

Consider this:

// fails second time...:
tabToHide.animate(options.fxAnimate[1], options.fxSpeed, ...);

// works fine...:
var hideAnim = $.extend({}, options.fxAnimate[1]); // copy object
tabToHide.animate(hideAnim, options.fxSpeed, ...);

It's a workaround, but I couldn't find out yet where and why the object 
is altered.


-- Klaus



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to