[Proto-Scripty] Re: Delay or defer ajax requests
Hi, Yes they do. I'm using Script.aculo.us but i have to start multiple animations (i.e. fadeouts) on multiple elements, so its a bit tricky to use the afterFinish functions because it would get called after every finish of every element. Ah. I'm not a scripty-head, but I wonder if the Parallel effect would help: http://wiki.github.com/madrobby/scriptaculous/effect-parallel Rick Waldron waldron.r...@gmail.com wrote on 07.12.2009 15:10:19: I'm not at a computer to try this out, and well, it might be a little hair-brained but perhaps... ( new Ajax.Updater() ).defer(); Nice idea. But it does not work :-/ Indeed not, all that does is create the Ajax.Updater object (which starts the update) and then try to call a #defer function on the returned Ajax.Updater instance -- which isn't a function and doesn't have a #defer function. I'm still not seeing why wrapping up the call in a function is a problem. It seems like a simple and straightforward solution, if you can't use an `afterFinish` callback (which is, of course, also a function). FWIW, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 7, 8:56 pm, David S. evil.zweitaus...@googlemail.com wrote: T.J. Crowder t...@crowdersoftware.com wrote on 12.07.2009 09:38:54 AM: Hi, Your animations don't provide an `afterFinish` callback or similar? Yes they do. I'm using Script.aculo.us but i have to start multiple animations (i.e. fadeouts) on multiple elements, so its a bit tricky to use the afterFinish functions because it would get called after every finish of every element. Here's the piece of code: var teaser_select = function (t) { var t_id = t.identify(); t.absolutize(); // Use before offset calculation! var moveby_y = t.cumulativeOffset().top; moveby_y -= ($('mv_logo').cumulativeOffset().top + $ ('mv_logo').getHeight()); moveby_y *= -1; new Effect.Move(t,{ duration: 0.5, x: 0, y: moveby_y, mode: 'relative' }); // Fade out all teasers from bottom to top $$('.teaser').reverse().each(function (teaser) { if (teaser.identify() == t_id) return; teaser.fade({ duration: 0.5, from: 1, to: 0 }); }); // TODO: // Call ajax after all teasers have been hidden } Maybe there's a simpler way to fade out more than one element at once and the each(...)-iteration becomes needless. Or its possible to call one function after many effects have been finished. But how? Rick Waldron waldron.r...@gmail.com wrote on 07.12.2009 15:10:19: I'm not at a computer to try this out, and well, it might be a little hair-brained but perhaps... ( new Ajax.Updater() ).defer(); Nice idea. But it does not work :-/ David. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Delay or defer ajax requests
Hi, I'm using animations on my website, and i want to start an Ajax request after a animation has finished. So i want to use Function.defer (...) on the Ajax.Updater function. Your animations don't provide an `afterFinish` callback or similar? (Script.aculo.us' do, but you didn't say you were using script.aculo.us, so I'm not assuming.) I don't want to create a new function for using the delay: Pretty sure that's your only choice. What's your objection to it? HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 6, 10:51 pm, David S. evil.zweitaus...@googlemail.com wrote: Hello. I'm using animations on my website, and i want to start an Ajax request after a animation has finished. So i want to use Function.defer (...) on the Ajax.Updater function. The problem is that the Ajax.Updater must be initiated using the new keyword, but then Ajax.Updater isn't working. I tried it like this: new Ajax.Updater.defer(5,'main_body', '?topic='+topic, { evalScripts: true }); I don't want to create a new function for using the delay: var submit_ajax = function(topic) { new Ajax.Updater('main_body', '?topic='+topic, { evalScripts: true });} submit_ajax.delay(0.7,topic); How is it possible to run functions that require new after a delay. Thanks. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Delay or defer ajax requests
Hi David, You could also modify the AJAX Base class to accept a delay parameter, but it's more complex comparing to create an anonymous (or not) function ! I did not see any other choice. But I think that you should refine your question, because if your using scriptaculous, TJ response is the ONE :)) -- david On 7 déc, 09:38, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I'm using animations on my website, and i want to start an Ajax request after a animation has finished. So i want to use Function.defer (...) on the Ajax.Updater function. Your animations don't provide an `afterFinish` callback or similar? (Script.aculo.us' do, but you didn't say you were using script.aculo.us, so I'm not assuming.) I don't want to create a new function for using the delay: Pretty sure that's your only choice. What's your objection to it? HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 6, 10:51 pm, David S. evil.zweitaus...@googlemail.com wrote: Hello. I'm using animations on my website, and i want to start an Ajax request after a animation has finished. So i want to use Function.defer (...) on the Ajax.Updater function. The problem is that the Ajax.Updater must be initiated using the new keyword, but then Ajax.Updater isn't working. I tried it like this: new Ajax.Updater.defer(5,'main_body', '?topic='+topic, { evalScripts: true }); I don't want to create a new function for using the delay: var submit_ajax = function(topic) { new Ajax.Updater('main_body', '?topic='+topic, { evalScripts: true });} submit_ajax.delay(0.7,topic); How is it possible to run functions that require new after a delay. Thanks. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: Delay or defer ajax requests
I'm not at a computer to try this out, and well, it might be a little hair-brained but perhaps... ( new Ajax.Updater() ).defer(); -- Sent from my Palm Prē T.J. Crowder wrote: Hi, I'm using animations on my website, and i want to start an Ajax request after a animation has finished. So i want to use Function.defer (...) on the Ajax.Updater function. Your animations don't provide an `afterFinish` callback or similar? (Script.aculo.us' do, but you didn't say you were using script.aculo.us, so I'm not assuming.) I don't want to create a new function for using the delay: Pretty sure that's your only choice. What's your objection to it? HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 6, 10:51 pm, David S. lt;evil.zweitaus...@googlemail.com wrote: Hello. I'm using animations on my website, and i want to start an Ajax request after a animation has finished. So i want to use Function.defer (...) on the Ajax.Updater function. The problem is that the Ajax.Updater must be initiated using the new keyword, but then Ajax.Updater isn't working. I tried it like this: new Ajax.Updater.defer(5,'main_body', '?topic='+topic, { evalScripts: true }); I don't want to create a new function for using the delay: var submit_ajax = function(topic) { new Ajax.Updater('main_body', '?topic='+topic, { evalScripts: true });} submit_ajax.delay(0.7,topic); How is it possible to run functions that require new after a delay. Thanks. -- You received this message because you are subscribed to the Google Groups Prototype amp; script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.