# RJS Queue

**URL:** <https://www.ruby-forum.com/t/rjs-queue/93463>\
**Category:** Rails\
**Created:** [April 3, 2006, 7:40pm UTC](https://www.ruby-forum.com/t/rjs-queue/93463 "2006-04-03T19:40:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 3, 2006, 7:40pm UTC](https://www.ruby-forum.com/t/rjs-queue/93463/1 "2006-04-03T19:40:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 3, 2006, 7:46pm UTC](https://www.ruby-forum.com/t/rjs-queue/93463/2 "2006-04-03T19:46:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 3, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/rjs-queue/93463/3 "2006-04-03T19:57:03Z")

</div>

Charlie,

Check out this page for details:

[http://www.railsdevelopment.com/2006/01/15/effectqueue/](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

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 3, 2006, 8:26pm UTC](https://www.ruby-forum.com/t/rjs-queue/93463/4 "2006-04-03T20:26:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 3, 2006, 8:08pm UTC](https://www.ruby-forum.com/t/rjs-queue/93463/5 "2006-04-03T20:08:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 3, 2006, 8:30pm UTC](https://www.ruby-forum.com/t/rjs-queue/93463/6 "2006-04-03T20:30:43Z")

</div>

Thanks Sergei. I’ll try it out.
