"T.J. Crowder" <t...@crowdersoftware.com> wrote on 12.07.2009 09:38:54
AM:

> Hi,

>

> Your animations don't provide an `afterFinish` callback or similar?



Yes they do. I'm using Script.aculo.us but i have to start multiple
animations (i.e. fadeouts) on multiple elements, so its a bit tricky
to use the afterFinish functions because it would get called after
every finish of every element.



Here's the piece of code:

var teaser_select = function (t) {

 var t_id = t.identify();

 t.absolutize(); // Use before offset calculation!

 var moveby_y  = t.cumulativeOffset().top;

 moveby_y -= ($('mv_logo').cumulativeOffset().top + $
('mv_logo').getHeight());

 moveby_y *= -1;

 new Effect.Move(t,{ duration: 0.5, x: 0, y: moveby_y, mode:
'relative' });

 // Fade out all teasers from bottom to top

 $$('.teaser').reverse().each(function (teaser) {

  if (teaser.identify() == t_id) return;

  teaser.fade({ duration: 0.5, from: 1, to: 0 });

 });

 // TODO:

 // Call ajax after all teasers have been hidden

}



Maybe there's a simpler way to fade out more than one element at once
and the each(...)-iteration becomes needless. Or its possible to call
one function after many effects have been finished.

But how?



"Rick Waldron" <waldron.r...@gmail.com> wrote on 07.12.2009 15:10:19:

> I'm not at a computer to try this out, and well, it might be a

> little hair-brained but perhaps...

>

> ( new Ajax.Updater() ).defer();



Nice idea. But it does not work :-/

David.

--

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 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.


Reply via email to