src/cm/media/js/lib/yui/yui3.0.0/examples/anim/anim-chaining_clean.html
author Yves-Marie Haussonne <ymh.work+github@gmail.com>
Fri, 09 May 2014 18:35:26 +0200
changeset 656 a84519031134
parent 0 40c8f766c9b8
permissions -rw-r--r--
add link to "privacy policy" in the header test


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Chaining Animations Using the <code>end</code> Event</title>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-min.js"></script>


<!--begin custom header content for this example-->
<link href="assets//anim.css" rel="stylesheet" type="text/css">

<!--end custom header content for this example-->

</head>

<body class=" yui-skin-sam">

<h1>Chaining Animations Using the <code>end</code> Event</h1>

<div class="exampleIntro">
	<p>This demonstrates how to use the <code>end</code> event to chain animations runs together.</p>
<p> Click the X in the header to fade the element out, then shrink its height to zero.</p>

			
</div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

    
<div id="demo" class="yui-module">
    <div class="yui-hd">
        <h4>Animation Demo</h4>
        <a title="remove module" class="yui-remove"><em>x</em></a>
    </div>
    <div class="yui-bd">
        <p>This an example of what you can do with the YUI Animation Utility.</p>
        <p><em>Follow the instructions above to see the animation in action.</em></p>
    </div>
</div>
<p>This is placeholder text used to demonstrate how the above animation affects subsequent content.</p> 
<script type="text/javascript">
YUI({base:"../../build/", timeout: 10000}).use("anim", function(Y) {
    var anim = new Y.Anim({
        node: '#demo',
        to: { opacity: 0 }
    });

    var onEnd = function() {
        this.unsubscribe('end', onEnd);
        this.setAttrs({
            to: { height: 1 },
            easing: Y.Easing.bounceOut
        });
        this.run();
    };

    anim.on('end', onEnd);

    Y.get('#demo .yui-remove').on('click', anim.run, anim);

});

</script>

<!--END SOURCE CODE FOR EXAMPLE =============================== -->

</body>
</html>