diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/examples/anim/anim-chaining.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/examples/anim/anim-chaining.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,246 @@ + + + + + YUI Library Examples: Animation: Chaining Animations Using the <code>end</code> Event + + + + + + + + + + + + +
+
+
+

+ + YUI 3.x Home - + +

+
+ + +
+ + + +
+
+
+
+

YUI Library Examples: Animation: Chaining Animations Using the end Event

+
+
+ +

Note: This is YUI 3.x. Looking for YUI 2.x?

+ +
+
+
+
+ +

Animation: Chaining Animations Using the end Event

+ +
+

+

This demonstrates how to use the end event to chain animations runs together.

+

Click the X in the header to fade the element out, then shrink its height to zero.

+ +

+ +
+
+ + + + + +
+
+

Animation Demo

+ x +
+
+

This an example of what you can do with the YUI Animation Utility.

+

Follow the instructions above to see the animation in action.

+
+
+

This is placeholder text used to demonstrate how the above animation affects subsequent content.

+ + + + + +
+
+
+ +

Setting up the HTML

+

First we add some HTML to animate.

+ + +

Creating the Anim Instance

+

Now we create an instance of Y.Anim, passing it a configuration object that includes the node we wish to animate and the to attribute containing the properties to be transitioned and final values.

+ + + +

Handling the End Event

+

We will need a function to run when the end event fires. Note that the context of our handler defaults to anim, so this refers to our Anim instance inside the handler.

+ +

Listening for the End Event

+

Now we will use the on method to subscribe to the end event, passing it our handler.

+ + + +

Running the Animation

+

Finally we add an event handler to run the animation.

+ + +

Full Script Source

+ +
+ +
+ +
+
+ + + +
+ +
+

Copyright © 2009 Yahoo! Inc. All rights reserved.

+

Privacy Policy - + Terms of Service - + Copyright Policy - + Job Openings

+
+
+ + + +