source: cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/examples/anim/reverse_clean.html @ 5259

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/examples/anim/reverse_clean.html@5259
Revision 5259, 2.8 KB checked in by domlowe, 11 years ago (diff)

adding yui javascript

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<meta http-equiv="content-type" content="text/html; charset=utf-8">
5<title>Reversing an Animation</title>
6
7<style type="text/css">
8/*margin and padding on body element
9  can introduce errors in determining
10  element position and are not recommended;
11  we turn them off as a foundation for YUI
12  CSS treatments. */
13body {
14        margin:0;
15        padding:0;
16}
17</style>
18
19<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
20<script type="text/javascript" src="../../build/yui/yui-min.js"></script>
21
22
23<!--begin custom header content for this example-->
24<link href="assets//anim.css" rel="stylesheet" type="text/css">
25
26<!--end custom header content for this example-->
27
28</head>
29
30<body class=" yui-skin-sam">
31
32<h1>Reversing an Animation</h1>
33
34<div class="exampleIntro">
35        <p>This demonstrates how to use the <code>reverse</code> attribute to change the behavior of the animation.</p>
36<p> Click the icon in the header to toggle the element's <code>height</code>.</p>
37
38                       
39</div>
40
41<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
42
43   
44<div id="demo" class="yui-module">
45    <div class="yui-hd">
46        <h4>Animation Demo</h4>
47    </div>
48    <div class="yui-bd">
49        <p>This an example of what you can do with the YUI Animation Utility.</p>
50        <p><em>Follow the instructions above to see the animation in action.</em></p>
51    </div>
52</div>
53<p>This is placeholder text used to demonstrate how the above animation affects subsequent content.</p> 
54<script type="text/javascript">
55YUI({base:"../../build/", timeout: 10000}).use("node-base", "anim-node-plugin", "anim-easing", function(Y) {
56    var module = Y.get('#demo');
57
58    // add fx plugin to module body
59    var content = module.query('.yui-bd').plug(Y.Plugin.NodeFX, {
60        from: { height: 0 },
61        to: {
62            height: function(node) { // dynamic in case of change
63                return node.get('scrollHeight'); // get expanded height (offsetHeight may be zero)
64            }
65        },
66
67        easing: Y.Easing.easeOut,
68        duration: 0.5
69    });
70
71    var onClick = function(e) {
72        module.toggleClass('yui-closed');
73        content.fx.set('reverse', !content.fx.get('reverse')); // toggle reverse
74        content.fx.run();
75    };
76
77    // use dynamic control for dynamic behavior
78    var control = Y.Node.create(
79        '<a title="show/hide content" class="yui-toggle">' +
80            '<em>toggle</em>' +
81        '</a>'
82    );
83
84    // append dynamic control to header section
85    module.query('.yui-hd').appendChild(control);
86    control.on('click', onClick);
87
88});
89
90</script>
91
92<!--END SOURCE CODE FOR EXAMPLE =============================== -->
93
94</body>
95</html>
96<!-- delightfuture.corp.yahoo.com uncompressed/chunked Wed Aug 13 16:45:30 PDT 2008 -->
Note: See TracBrowser for help on using the repository browser.