On 20 July 2010 17:59, Ralph Brickley <i...@topsoftweb.com> wrote:
> This is a revelation to me. I didn't know Effect had a multiple. Also, what 
> is curry?
> My solution has been to tag those elements with a class, ie <div 
> class="effects">
> Then use $$('effects') to get each item and all effects... On each
> Sent from my iPhone
> On Jul 20, 2010, at 9:08 AM, Richard Quadling <rquadl...@gmail.com> wrote:
>> On 20 July 2010 15:55, Febo <ilpuccio.f...@gmail.com> wrote:
>>> Hello,
>>> I'd like to use the toggle effect on multiple object at the same time
>>> I tried with
>>> Effect.multiple(['id_1','id_2','id_n'], Effect.toggle)
>>> but it doesn't work, also I don't know where/how to pass the 'appear'
>>> parameter
>>> I'm used to call toggle in this way:
>>> Effect.toggle('my_id_of_interest','appear')
>> At a guess, you need to curry() [1] the parameter.
>> So, can you try ...
>> Effect.multiple(['id_1','id_2','id_n'], Effect.toggle.curry('appear'));
>> Regards,
>> Richard.
>> [1] http://api.prototypejs.org/language/function/prototype/curry/

"Curries (burns in) arguments to a function, returning a new function
that when called with call the original passing in the curried
arguments (along with any new ones)"

The link http://api.prototypejs.org/language/function/prototype/curry/
is the documentation for curry.

So, Effect.toggle.curry('appear') returns a new function which, when
called, will call the Effect.toggle function with  'appear' as the
first parameter, along with any other parameters supplied by the
Effect.multiple() function.

Is it the same as $$('effects').invoke('toggle', 'appear');

Hmm. On the surface, probably yes. But I'm not an expert here.

One difference is that Effect.multiple allows you to supply any ids.

I suppose ...

Effect.multiple($$('effects'), Effect.toggle.curry('appear'));

could also be a similar approach.

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to