Klaus Hartl schrieb:
> Jörn Zaefferer schrieb:
>   
>> Jason Levine schrieb:
>>     
>>> I've updated JTicker to 0.5 Beta now.  I added the ability to have multiple 
>>> tickers on a single page.  This was a feature I really wanted to add and 
>>> had to learn a lot of new JavaScript to implement it.  So it was a win-win 
>>> situation for me.  ;-)   I hope you like it too:
>>>
>>> http://www.jasons-toolbox.com/JTicker/
>>>   
>>>       
>> Nice. Something that I see quite often in plugins and is usually solved 
>> different everytime: Customizing animations. In your case, two options 
>> 'transition' and 'speed' are provided. I'd like to see a more generic 
>> approach to this, that can be applied cross-plugin.
>> My first idea is to simply pass a hash through to animate(), eg:
>>
>> $().jticker({
>>     animate: {fade: "slow"}
>> }
>>
>> And then using that option with something like this:
>> $().animate(this.settings.animate);
>>
>> Unfortuanetely, it is not as easy as that, but maybe this gives a good 
>> starting point to find a more generic solution.
>>     
>
> I'm 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'}
});

This could then be applied to the jTicker, with something like this:
$().jticker({
    showTicker: { height: 'show'},
    hideTicker: { height: 'hide'}
});

This would enable plugin writes to simply point to the docs for animate, 
instead of documenting their custom animation parser over and over again.
> 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?

-- Jörn

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

Reply via email to