jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-27 19:19 UTC
3 prototype/scriptaculous effects in order on one <div>
What I am trying to do is fade out the content in a certain <div> load new content while its black then fade in the new content but im lost. I need it to go like this... Effect.Fade,Ajax.Update,Effect.Appear but everytime I try to do it it just trys to do all of them at once, how do I go about making the effects wait on the previous one before it starts? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Stripe-man
2006-Dec-03 10:05 UTC
Re: 3 prototype/scriptaculous effects in order on one <div>
im new at this.. but can you chain the functions (one calls the other)? On 11/27/06, jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > What I am trying to do is fade out the content in a certain <div> load > new content while its black then fade in the new content but im lost. > I need it to go like this... > Effect.Fade,Ajax.Update,Effect.Appear > but everytime I try to do it it just trys to do all of them at once, > how do I go about making the effects wait on the previous one before it > starts? > > > > >-- "I have learned that you should''nt compare yourself to others - they are more screwed up than you think." ...unknown "In the 60''s, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal." ..unknown _____________________________ Terry Remsik stripe-man.dyndns.org remsikt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Martin Bialasinski
2006-Dec-03 10:46 UTC
Re: 3 prototype/scriptaculous effects in order on one <div>
On 11/27/06, jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I need it to go like this... > Effect.Fade,Ajax.Update,Effect.Appear > but everytime I try to do it it just trys to do all of them at once,You need to start the next step in the callback that gets executed when the previous step finishes. Pseudo code: Effect.Fade(..., { afterFinish: function(){ Ajax.Update(..., { onComplete: function(){ Effect.Appear(...) } }) } }) onComplete is a guess, I do not use Prototype''s Ajax. Please look up the proper callback in the docs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2006-Dec-03 12:56 UTC
Re: 3 prototype/scriptaculous effects in order on one <div>
Hey Jakob, jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit :> What I am trying to do is fade out the content in a certain <div> load > new content while its black then fade in the new content but im lost. > I need it to go like this... > Effect.Fade,Ajax.Update,Effect.Appear > but everytime I try to do it it just trys to do all of them at once, > how do I go about making the effects wait on the previous one before it > starts?The best way to go is element-scoped effect queues. Other suggestions don''t scale well (such as manually chaining using afterFinish). You''ll find an example that takes your exact need one step further (and shows it can be done to multiple elements with no clashes) in my reply to a former post here. The thread: http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/eae1dcf7fd9f422f/ad1ebfc38b77ccf0 The online example: http://tddsworld.com/extrahost/rails-spinoffs/hoverfades.html -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Martin Bialasinski
2006-Dec-03 14:56 UTC
Re: 3 prototype/scriptaculous effects in order on one <div>
On 12/3/06, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit : > > Effect.Fade,Ajax.Update,Effect.Appear > The best way to go is element-scoped effect queues.With Ajax.Update inbetween? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Fabian Lange
2006-Dec-03 15:21 UTC
Re: 3 prototype/scriptaculous effects in order on one <div>
Terve, Actually this was the first post I made here. I solved it this way: --------snipp------- Effect.Updater = Class.create(); Object.extend(Object.extend(Effect.Updater.prototype, Effect.Base.prototype), { initialize: function(element) { this.element = $(element); var options = Object.extend({ duration: 0.001, newContent: '''' }, arguments[1] || {}); this.start(options); }, loop: function(timePos) { if(timePos >= this.startOn) { Element.update(this.element,this.options.newContent); this.cancel(); return; } } }); So I can now put this to the method I pass to onComplete of Ajax.Request function reload_content(ajax){ el = $(''content''); new Effect.Fade(el,{queue:''front''}); new Effect.Updater(el,{newContent:ajax.responseText,queue:''end''}); new Effect.Appear(el,{queue:''end''}); } --------snapp------- I hope that inspired Thomas, because he did add something for scriptaculous 1.6.5: http://mir.aculo.us/2006/11/8/script-aculo-us-1-6-5 new Effect.Event({ afterFinish:function(){ // do some code here }, position: ''end'' }); Thats what you want to do right? Unfortunately I had problems with appearing fading appearing fading etc on the same div over and over again (it seems that it slowed down and never appeared back to 100%) Hope that helps .: Fabian -----Original Message----- From: grbounce-_Pkz0AUAAAB9-VKt0-RY8LHUELm10l3Y=fabian.lange=web.de@googlegroups.c om [mailto:grbounce-_Pkz0AUAAAB9-VKt0-RY8LHUELm10l3Y=fabian.lange=web.de@google groups.com] On Behalf Of Martin Bialasinski Sent: Sonntag, 3. Dezember 2006 15:57 To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails-spinoffs] Re: 3 prototype/scriptaculous effects in order on one <div> On 12/3/06, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> jakobmetzger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit : > > Effect.Fade,Ajax.Update,Effect.Appear > The best way to go is element-scoped effect queues.With Ajax.Update inbetween? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Martin Bialasinski
2006-Dec-03 15:35 UTC
Re: 3 prototype/scriptaculous effects in order on one <div>
On 12/3/06, Fabian Lange <Fabian.Lange-S0/GAf8tV78@public.gmane.org> wrote:> Actually this was the first post I made here. I solved it this way:> loop: function(timePos) { > if(timePos >= this.startOn) { > Element.update(this.element,this.options.newContent); > this.cancel(); > return; > } > }> new Effect.Fade(el,{queue:''front''}); > new Effect.Updater(el,{newContent:ajax.responseText,queue:''end''}); > new Effect.Appear(el,{queue:''end''});I don''t see how this would work in the desired way. Element.update() is asyncronous. The Effect.Appear() will start just after the request was made, it will not wait until the response is in. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2006-Dec-03 18:32 UTC
Re: 3 prototype/scriptaculous effects in order on one <div>
Martin Bialasinski a écrit :> With Ajax.Update inbetween?Wooops! Sorry about that, ''read too fast. Then I guess it has to be done with manually chaining afterFinish/onComplete. Some up-front checking to avoid multiple parallel calls for the same element is also in order. -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---