Forum: Ruby on Rails rjs problems

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8f59dd1756c99858d05f25217b2ac3ff?d=identicon&s=25 Carl Woodward (Guest)
on 2006-01-19 09:08
(Received via mailing list)

I am having trouble with rjs templates. Basically I want the item_div
to fade if its already open and then display the new item that the
user selected with the visual effect: appear. The code below causes
the browser (firefox on osx) to open the div and then close it again
as soon as it is open:

page.visual_effect :fade, 'item_div', :duration => 0.5
page.replace_html 'item_div', :partial => 'edit'
page.visual_effect :appear, 'item_div', :duration => 0.5

Does anyone have any ideas or can anyone point me to some
documentation that explains this?

Just to check that I wasn't going insane the code below works as I would

page.hide 'item_div'
page.replace_html 'item_div', :partial => 'edit'
page.visual_effect :appear, 'item_div', :duration => 0.5

Thanks for your help,

Carl Woodward
E813e9cc70159e103a64a5237c0d3ee2?d=identicon&s=25 Thomas Fuchs (Guest)
on 2006-01-19 10:27
(Received via mailing list)
visual_effect doesn't block, so execution of JavaScript code doesn't
pause until the visual effect is over.

You need to use the visual effect callbacks to achieve this (currently
there's no direct support in Rails for them (you probably need
to write JavaScript manually for this).


Am 19.01.2006 um 08:31 schrieb Carl Woodward:
This topic is locked and can not be replied to.