I was going to change the background of a div from white to red and then from red back to white, so this is used in an RJS file: page[:vote_score].visual_effect :highlight, :startcolor => ''#ffffff'', :endcolor => ''#ffcccc'' page[:vote_score].visual_effect :highlight, :startcolor => ''#ffcccc'', :endcolor => ''#ffffff'' But looks like they happen at the same time, instead of one after another. Is there a way to make it happen one after another? the Javascript sent to the browser is: try { $("vote_score").update("Score 63"); $("vote_score").visualEffect("highlight", {"endcolor":"#ffcccc","startcolor":"#ffffff"}); $("vote_score").visualEffect("highlight", {"endcolor":"#ffffff","startcolor":"#ffcccc"}); } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''$(\"vote_score\").update(\"Score 63\");\n$(\"vote_score\").visualEffect(\"highlight\", {\"restorecolor\":\"#ffcccc\",\"endcolor\":\"#ffcccc\",\"startcolor\":\"#ffffff\"});\n$(\"vote_score\").visualEffect(\"highlight\", {\"endcolor\":\"#ffffff\",\"startcolor\":\"#ffcccc\"});''); throw e } -- Posted via ruby-forum.com. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-May-24 14:47 UTC
Re: Two RJS visual effects will happen at the same time?
On May 24, 2:26 pm, Jian Lin <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> But looks like they happen at the same time, instead of one after > another. Is there a way to make it happen one after another?The visual_effect takes a queue option, read something like script.aculo.us/docs/EffectQueues.html to understand how effect queues work etc. Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
I found Ajax on Rails, from O''Reilly, to be an excellent book, if it''s any help. On May 24, 9:26 am, Jian Lin <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I was going to change the background of a div from white to red and then > from red back to white, so this is used in an RJS file: > > page[:vote_score].visual_effect :highlight, :startcolor => ''#ffffff'', > :endcolor => ''#ffcccc'' > > page[:vote_score].visual_effect :highlight, :startcolor => ''#ffcccc'', > :endcolor => ''#ffffff'' > > But looks like they happen at the same time, instead of one after > another. Is there a way to make it happen one after another? > > the Javascript sent to the browser is: > > try { > $("vote_score").update("Score 63"); > $("vote_score").visualEffect("highlight", > {"endcolor":"#ffcccc","startcolor":"#ffffff"}); > $("vote_score").visualEffect("highlight", > {"endcolor":"#ffffff","startcolor":"#ffcccc"});} catch (e) { alert(''RJS error:\n\n'' + e.toString()); > > alert(''$(\"vote_score\").update(\"Score > 63\");\n$(\"vote_score\").visualEffect(\"highlight\", > {\"restorecolor\":\"#ffcccc\",\"endcolor\":\"#ffcccc\",\"startcolor\":\"#ffffff\"});\n$(\"vote_score\").visualEffect(\"highlight\", > {\"endcolor\":\"#ffffff\",\"startcolor\":\"#ffcccc\"});''); throw e } > -- > Posted viahttp://www.ruby-forum.com. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.