Two RJS visual effects will happen at the same time?

Jian Lin
Mon, 24 May 2010 13:26:54 -0000

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 http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org