Scriptaculous effects have a queue
option, which you can give as a parameter to visual_effect
. For instance,
render :update do |page|
page.replace_html replace_html 'notice', flash[:notice]
page.visual_effect :blind_down, "notice", :duration => 0.5, :queue => 'end'
page.visual_effect :blind_up, "notice", :duration => 0.5, :queue => 'end'
end
will queue the two effects so that the blind up effect doesn't start until the blind down finishes.
See Effect Queues on the script.aculo.us github wiki for more information about how queues work and the parameters you can give to queue (for instance, by default, one queue is used for the page, but you can define multiple queues if you want various effect queues to run in parallel). :queue
can take either a string (as above) or a hash, which lets you have more customization:
:queue => { :position => 'end', :scope => 'my_effect_queue' }