I''m trying to string together a few visual effects and having a ton of trouble making it work. I''ve searched this forum and read the couple of threads dealing with this but I''m not having much luck with solutions presented there. Essentially, I want to fade an image, replace it with a new image, then appear it back. But in the interests of simplifying the problem, let''s just say I want to fade an image and then appear it back (gradually, using the appear effect). So, I have this in a view: <div id="testimage1"><%= image_tag("products_main_forever.jpg") %></div> <div id="testimage2"><%= image_tag("products_main_wood.jpg") %></div> <%= link_to_remote ''Change1'', :url => {:action => ''change_image1''} %> <%= link_to_remote ''Change2'', :url => {:action => ''change_image2''} %> and in my controller I have this: def change_image1 render :update do |page| page.visual_effect(:fade, "testimage1", {:queue => "front"}) end end def change_image2 render :update do |page| page.visual_effect(:fade, "testimage2", {:queue => "front"}) page.visual_effect(:appear, "testimage1", {:queue => "end"}) end end And it works fine - click the first link and the first image fades; click the second link and the second image fades, then the first image appears, in order. However, if I try to fade and appear the same image, with something like this in the controller: def change_image2 render :update do |page| page.visual_effect(:fade, "testimage2", {:queue => "front"}) page.visual_effect(:appear, "testimage2", {:queue => "end"}) end end It does not work. The image fades, then just comes back in a blink without the appear effect showing. I see some stuff out there about :beforeStart and whatnot but can''t seem to find any syntax for laying that out that works to solve the problem. I''ve also gone over and over http://blog.railsdevelopment.com/pages/effect/queue/ and can''t find an answer there either. I would appreciate any help or links/pointers to some help. c. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
ive had this problem as well. the fade and the appear are happening on top of each other and the element seems to get confused and dissapears at the end instead of staying visible. the only solution i''ve found is to write it in raw JS; whether by using the << "new Effect(..." method in my controller/rjs template or simply coding it manually in the view as inline JS. id certainly be interested in hearing a better solution! ed On 9/20/06, Cayce Balara <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I''m trying to string together a few visual effects and having a ton of > trouble making it work. I''ve searched this forum and read the couple of > threads dealing with this but I''m not having much luck with solutions > presented there. Essentially, I want to fade an image, replace it with a > new image, then appear it back. But in the interests of simplifying the > problem, let''s just say I want to fade an image and then appear it back > (gradually, using the appear effect). > > So, I have this in a view: > > <div id="testimage1"><%= image_tag("products_main_forever.jpg") %></div> > <div id="testimage2"><%= image_tag("products_main_wood.jpg") %></div> > <%= link_to_remote ''Change1'', :url => {:action => ''change_image1''} %> > <%= link_to_remote ''Change2'', :url => {:action => ''change_image2''} %> > > and in my controller I have this: > > def change_image1 > render :update do |page| > page.visual_effect(:fade, "testimage1", {:queue => "front"}) > end > end > > def change_image2 > render :update do |page| > page.visual_effect(:fade, "testimage2", {:queue => "front"}) > page.visual_effect(:appear, "testimage1", {:queue => "end"}) > end > end > > And it works fine - click the first link and the first image fades; > click the second link and the second image fades, then the first image > appears, in order. > > However, if I try to fade and appear the same image, with something like > this in the controller: > > def change_image2 > render :update do |page| > page.visual_effect(:fade, "testimage2", {:queue => "front"}) > page.visual_effect(:appear, "testimage2", {:queue => "end"}) > end > end > > It does not work. The image fades, then just comes back in a blink > without the appear effect showing. > > I see some stuff out there about :beforeStart and whatnot but can''t seem > to find any syntax for laying that out that works to solve the problem. > I''ve also gone over and over > http://blog.railsdevelopment.com/pages/effect/queue/ and can''t find an > answer there either. > > I would appreciate any help or links/pointers to some help. > > c. > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ed Hickey Developer Litmus Media 816-533-0409 ehickey-A4HEbNdjHgMmlAP/+Wk3EA@public.gmane.org A Member of Think Partnership, Inc www.ThinkPartnership.com Amex ticker symbol: THK --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
def change_image2 render :update do |page| page.visual_effect :fade, "testimage2", :duration => 0.5 page.delay 0.5 do page.visual_effect :appear, "testimage2", :duration => 0.5 end end end On 21 Sep 2006, at 05:02, Ed Hickey wrote:> ive had this problem as well. the fade and the appear are > happening on top of each other and the element seems to get > confused and dissapears at the end instead of staying visible. > the only solution i''ve found is to write it in raw JS; whether by > using the << "new Effect(..." method in my controller/rjs template > or simply coding it manually in the view as inline JS. > > id certainly be interested in hearing a better solution! > > ed > > > On 9/20/06, Cayce Balara < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > I''m trying to string together a few visual effects and having a ton of > trouble making it work. I''ve searched this forum and read the > couple of > threads dealing with this but I''m not having much luck with solutions > presented there. Essentially, I want to fade an image, replace it > with a > new image, then appear it back. But in the interests of simplifying > the > problem, let''s just say I want to fade an image and then appear it > back > (gradually, using the appear effect). > > So, I have this in a view: > > <div id="testimage1"><%= image_tag("products_main_forever.jpg") %></ > div> > <div id="testimage2"><%= image_tag("products_main_wood.jpg") %></div> > <%= link_to_remote ''Change1'', :url => {:action => ''change_image1''} %> > <%= link_to_remote ''Change2'', :url => {:action => ''change_image2''} %> > > and in my controller I have this: > > def change_image1 > render :update do |page| > page.visual_effect(:fade, "testimage1", {:queue => "front"}) > end > end > > def change_image2 > render :update do |page| > page.visual_effect(:fade, "testimage2", {:queue => "front"}) > page.visual_effect(:appear, "testimage1", {:queue => "end"}) > end > end > > And it works fine - click the first link and the first image fades; > click the second link and the second image fades, then the first image > appears, in order. > > However, if I try to fade and appear the same image, with something > like > this in the controller: > > def change_image2 > render :update do |page| > page.visual_effect(:fade, "testimage2", {:queue => "front"}) > page.visual_effect(:appear, "testimage2", {:queue => "end"}) > end > end > > It does not work. The image fades, then just comes back in a blink > without the appear effect showing. > > I see some stuff out there about :beforeStart and whatnot but can''t > seem > to find any syntax for laying that out that works to solve the > problem. > I''ve also gone over and over > http://blog.railsdevelopment.com/pages/effect/queue/ and can''t find an > answer there either. > > I would appreciate any help or links/pointers to some help. > > c. > > -- > Posted via http://www.ruby-forum.com/. > > > > > -- > Ed Hickey > Developer > Litmus Media > 816-533-0409 > ehickey-A4HEbNdjHgMmlAP/+Wk3EA@public.gmane.org > A Member of Think Partnership, Inc > www.ThinkPartnership.com > Amex ticker symbol: THK > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
That rocks! Thanks so much for the help. c. Peter De Berdt wrote:> def change_image2 > render :update do |page| > page.visual_effect :fade, "testimage2", :duration => 0.5 > page.delay 0.5 do > page.visual_effect :appear, "testimage2", :duration => 0.5 > end > end > end-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---