Yeah, that's what I was thinking.
I feel like making a plugin out of this, then we'll see how effective
it is.

May I ? (xwisdom).

Cheers

--
Ariel Flesler
http://flesler.blogspot.com/

On Oct 20, 2:50 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> It seems that the tricky part is that the hide() function (as in all
> animation functions) use a setInterval, but return the "this" object
> immediately.
>
> Ohhh.  I have an idea.
>
> What if the wait() function set a flag in the object saying this object is
> waiting for an animation to finish.
>
> Then, any subsequent jQuery.fn methods that are called get added to a queue
> to be executed after the animation is finished.
>
> Once the animation is done, the wait flag is turned off and jQuery.fn
> methods are executed immediately as usual.
>
> So it would look like this:
>
> jQuery("div").hide("slow")
>   .wait()
>   .addClass("done")
>   .find("span")
>     .addClass("done")
>   .end()
>   .show("slow")
>   .wait()
>   .removeClass("done")
>   .find("span")
>     .removeClass("done");
>
> JK
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
>
> Behalf Of nikomomo
> Sent: Monday, October 20, 2008 1:01 AM
> To: jQuery Development
> Subject: [jquery-dev] Re: Ultra-Chaining with jQuery
>
> First, you can do that with the callback parameter.
>
> jQuery("div").hide("slow")
>   .wait()
>   .addClass("done")
>   .find("span")
>     .addClass("done")
>   .end()
>   .show("slow", function() {
>     $(this).removeClass("done");
>   })
>
> But to create a wait() function, I think you have to create a lock/
> semaphore (a simple counter), incremented in jQuery.anime (or anything
> that create a timer callback?), decremented at the end of the anime,
> and tested in the wait() function.
>
> On 20 oct, 00:29, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> > That's an interesting idea -- personally I like this syntax a lot.
>
> > But because javascript isn't a true multithreading environment, I wonder
> if
> > this would be possible at all.
>
> > It's not like the wait() function can detect for the existence of an
> > animation, pause execution until the animation is done, and only then
> return
> > the "this" object.
>
> > Does anyone know if there's a way to create such behavior?
>
> > JK
>
> > -----Original Message-----
> > From: [email protected] [mailto:[EMAIL PROTECTED] On
>
> > Behalf Of xwisdom
> > Sent: Sunday, October 19, 2008 12:43 PM
> > To: jQuery Development
> > Subject: [jquery-dev] RE: Ultra-Chaining with jQuery
>
> > Sorry Guys but I could not find the thread mentioned on John's
> > website:http://ejohn.org/blog/ultra-chaining-with-jquery/
>
> > Anyway, the chaining system looks ok but rather than using a chain()
> > metod how about using a wait() method that would block or process
> > succeeding calls after the preceding call has been completed:
>
> > jQuery("div").hide("slow")
> >   .wait()
> >   .addClass("done")
> >   .find("span")
> >     .addClass("done")
> >   .end()
> >   .show("slow")
> >   .wait()
> >   .removeClass("done")
>
> > Just my 2cents
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to