RJS Queue

Hi,

I’ve been able to succesfully queue page.visual_effect commands in my
RJS templates. Each command will wait to execute until the previous
command is done executing.

But I’d also like to execute a page.replace_html command AFTER the
page.visual_effect commands. I have a series of five DIVs:

div1
div2
div3
div4
div5

When the user clicks on div1, a page.visual_effect command is executed
in div1 disappears. At this point, I want to execute a
page.replace_html command on my divs. Right now, the visual_effect and
replace_html execute in parallel, so you never see the visual_effect
take place.

Can anyone help me with this?

Thanks in advance!

Brandon

I hope I’m wrong, but I don’t think that can be done without writing
your own javascript. I’ve asked the same question multiple times but no
answer. Could you post your queued visual effects code. I haven’t
tried to do that with rjs yet.

Charlie,

Check out this page for details:

http://www.railsdevelopment.com/2006/01/15/effectqueue/

All I had to do was add the :queue => ‘end’ parameter to the end of my
visual_effect commands. I hope this helps.

Brandon

Thank you! I’ve been trying to figure out how to do this but to no
avail!

Hi Brandon,

Effects have events you can use to syncronize your other code with them.

For example:

new Effect.BlindDown(‘customer_edit’, {
afterFinish: function(element){alert(‘You can see it now’);}
});

Event names are beforeStart, beforeSetup, beforeUpdate, beforeFinish and
their ‘after’ mates.

Enjoy.

Thanks Sergei. I’ll try it out.