|
0
|
1 |
|
|
|
2 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
|
|
3 |
<html> |
|
|
4 |
<head> |
|
|
5 |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> |
|
|
6 |
<title>Using the End Event</title> |
|
|
7 |
|
|
|
8 |
<style type="text/css"> |
|
|
9 |
/*margin and padding on body element |
|
|
10 |
can introduce errors in determining |
|
|
11 |
element position and are not recommended; |
|
|
12 |
we turn them off as a foundation for YUI |
|
|
13 |
CSS treatments. */ |
|
|
14 |
body { |
|
|
15 |
margin:0; |
|
|
16 |
padding:0; |
|
|
17 |
} |
|
|
18 |
</style> |
|
|
19 |
|
|
|
20 |
<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" /> |
|
|
21 |
<script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
<!--begin custom header content for this example--> |
|
|
25 |
<link href="assets//anim.css" rel="stylesheet" type="text/css"> |
|
|
26 |
|
|
|
27 |
<!--end custom header content for this example--> |
|
|
28 |
|
|
|
29 |
</head> |
|
|
30 |
|
|
|
31 |
<body class=" yui-skin-sam"> |
|
|
32 |
|
|
|
33 |
<h1>Using the End Event</h1> |
|
|
34 |
|
|
|
35 |
<div class="exampleIntro"> |
|
|
36 |
<p>This demonstrates how to use the <code>end</code> event.</p> |
|
|
37 |
<p> Click the X in the header to fade the element out and remove it from the document once the fade completes.</p> |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
</div> |
|
|
41 |
|
|
|
42 |
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== --> |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
<div id="demo" class="yui-module"> |
|
|
46 |
<div class="yui-hd"> |
|
|
47 |
<h4>Animation Demo</h4> |
|
|
48 |
<a title="remove module" class="yui-remove"><em>x</em></a> |
|
|
49 |
</div> |
|
|
50 |
<div class="yui-bd"> |
|
|
51 |
<p>This an example of what you can do with the YUI Animation Utility.</p> |
|
|
52 |
<p><em>Follow the instructions above to see the animation in action.</em></p> |
|
|
53 |
</div> |
|
|
54 |
</div> |
|
|
55 |
<p>This is placeholder text used to demonstrate how the above animation affects subsequent content.</p> |
|
|
56 |
<script type="text/javascript"> |
|
|
57 |
YUI({base:"../../build/", timeout: 10000}).use("anim", function(Y) { |
|
|
58 |
var anim = new Y.Anim({ |
|
|
59 |
node: '#demo', |
|
|
60 |
to: { opacity: 0 } |
|
|
61 |
}); |
|
|
62 |
|
|
|
63 |
var onEnd = function() { |
|
|
64 |
var node = this.get('node'); |
|
|
65 |
node.get('parentNode').removeChild(node); |
|
|
66 |
}; |
|
|
67 |
|
|
|
68 |
anim.on('end', onEnd); |
|
|
69 |
|
|
|
70 |
Y.get('#demo .yui-remove').on('click', anim.run, anim); |
|
|
71 |
|
|
|
72 |
}); |
|
|
73 |
|
|
|
74 |
</script> |
|
|
75 |
|
|
|
76 |
<!--END SOURCE CODE FOR EXAMPLE =============================== --> |
|
|
77 |
|
|
|
78 |
</body> |
|
|
79 |
</html> |