|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en" class="yui3-loading"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Creating an animated panel using transitions</title> |
|
|
6 |
<link rel="stylesheet" href="http://yui.yahooapis.com/combo?3.10.3/build/cssreset/reset-min.css&3.10.3/build/cssfonts/fonts-min.css&3.10.3/build/cssbase/base-min.css"> |
|
|
7 |
<script src="../../build/yui/yui-min.js"></script> |
|
|
8 |
|
|
|
9 |
<script> |
|
|
10 |
YUI.Env.Tests = { |
|
|
11 |
examples: [], |
|
|
12 |
project: '../assets', |
|
|
13 |
assets: '../assets/panel', |
|
|
14 |
name: 'panel-animate', |
|
|
15 |
title: 'Creating an animated panel using transitions', |
|
|
16 |
newWindow: '', |
|
|
17 |
auto: false |
|
|
18 |
}; |
|
|
19 |
YUI.Env.Tests.examples.push('panel-form'); |
|
|
20 |
YUI.Env.Tests.examples.push('panel-animate'); |
|
|
21 |
YUI.Env.Tests.examples.push('dialog'); |
|
|
22 |
|
|
|
23 |
</script> |
|
|
24 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
25 |
|
|
|
26 |
|
|
|
27 |
</head> |
|
|
28 |
<body class="yui3-skin-sam"> |
|
|
29 |
|
|
|
30 |
<style type="text/css"> |
|
|
31 |
|
|
|
32 |
.yui3-panel { |
|
|
33 |
outline: none; |
|
|
34 |
} |
|
|
35 |
|
|
|
36 |
.yui3-panel #panelContent { |
|
|
37 |
-webkit-box-shadow: 0px 0px 2px black; |
|
|
38 |
-moz-box-shadow: 0px 0px 2px black; |
|
|
39 |
box-shadow: 0px 0px 2px black; |
|
|
40 |
} |
|
|
41 |
.yui3-panel #panelContent .yui3-widget-hd { |
|
|
42 |
font-weight: bold; |
|
|
43 |
padding: 5px; |
|
|
44 |
} |
|
|
45 |
|
|
|
46 |
#panelContent .yui3-widget-bd { |
|
|
47 |
padding: 15px; |
|
|
48 |
background: white; |
|
|
49 |
text-align: center; |
|
|
50 |
} |
|
|
51 |
|
|
|
52 |
#panelContent.yui3-widget-loading { |
|
|
53 |
display: none; |
|
|
54 |
} |
|
|
55 |
|
|
|
56 |
.yui3-skin-sam .yui3-widget-mask { |
|
|
57 |
background-color: #223460; |
|
|
58 |
opacity: 0.9; |
|
|
59 |
} |
|
|
60 |
|
|
|
61 |
</style> |
|
|
62 |
|
|
|
63 |
<h2>Creating an animated panel using transitions</h2> |
|
|
64 |
|
|
|
65 |
<p> |
|
|
66 |
This example shows an animated modal form. |
|
|
67 |
<button id="openButton">Open Panel</button> |
|
|
68 |
</p> |
|
|
69 |
|
|
|
70 |
<p> |
|
|
71 |
Now let's fill this space with some text so that the modality kicks in. |
|
|
72 |
</p> |
|
|
73 |
|
|
|
74 |
<p> |
|
|
75 |
Vestibulum quis purus metus. Quisque in adipiscing erat. Class aptent taciti |
|
|
76 |
sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In vitae |
|
|
77 |
lacus tellus, non iaculis arcu. Donec nec risus diam. Vivamus sed mauris eros, |
|
|
78 |
nec ultrices nibh. Phasellus scelerisque aliquet mauris, faucibus aliquam ipsum |
|
|
79 |
tempor quis. Integer quis risus sed tellus ornare venenatis quis ut magna. |
|
|
80 |
Integer erat mauris, hendrerit faucibus iaculis eu, feugiat vitae massa. Aliquam |
|
|
81 |
mi augue, tincidunt id porttitor ut, lacinia sed eros. Vestibulum ante ipsum |
|
|
82 |
primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed elementum |
|
|
83 |
fringilla urna vel cursus. Etiam et suscipit eros. In ornare lacinia est, sed |
|
|
84 |
bibendum ligula blandit nec. Vestibulum tristique pulvinar nunc, quis lacinia |
|
|
85 |
eros facilisis vel. Duis tristique porttitor risus, vel laoreet ligula mollis |
|
|
86 |
vitae. Nam ornare justo a turpis mattis cursus. |
|
|
87 |
</p> |
|
|
88 |
|
|
|
89 |
<div id="panelContent" class="yui3-widget-loading"> |
|
|
90 |
<div class="yui3-widget-hd"> |
|
|
91 |
Showing an animated panel |
|
|
92 |
</div> |
|
|
93 |
<div class="yui3-widget-bd"> |
|
|
94 |
<p>Making panels animate is easy with the "transition" module!</p> |
|
|
95 |
</div> |
|
|
96 |
</div> |
|
|
97 |
|
|
|
98 |
|
|
|
99 |
<script type="text/javascript"> |
|
|
100 |
YUI().use('transition', 'panel', function (Y) { |
|
|
101 |
|
|
|
102 |
var openBtn = Y.one('#openButton'), |
|
|
103 |
panel, bb; |
|
|
104 |
|
|
|
105 |
function showPanel() { |
|
|
106 |
panel.show(); |
|
|
107 |
bb.transition({ |
|
|
108 |
duration: 0.5, |
|
|
109 |
top : '80px' |
|
|
110 |
}); |
|
|
111 |
} |
|
|
112 |
|
|
|
113 |
function hidePanel() { |
|
|
114 |
bb.transition({ |
|
|
115 |
duration: 0.5, |
|
|
116 |
top : '-300px' |
|
|
117 |
}, function () { |
|
|
118 |
panel.hide(); |
|
|
119 |
}); |
|
|
120 |
} |
|
|
121 |
|
|
|
122 |
panel = new Y.Panel({ |
|
|
123 |
srcNode: '#panelContent', |
|
|
124 |
width : 330, |
|
|
125 |
xy : [300, -300], |
|
|
126 |
zIndex : 5, |
|
|
127 |
modal : true, |
|
|
128 |
visible: false, |
|
|
129 |
render : true, |
|
|
130 |
buttons: [ |
|
|
131 |
{ |
|
|
132 |
value : 'Close the panel', |
|
|
133 |
section: 'footer', |
|
|
134 |
action : function (e) { |
|
|
135 |
e.preventDefault(); |
|
|
136 |
hidePanel(); |
|
|
137 |
} |
|
|
138 |
} |
|
|
139 |
] |
|
|
140 |
}); |
|
|
141 |
|
|
|
142 |
bb = panel.get('boundingBox'); |
|
|
143 |
|
|
|
144 |
openBtn.on('click', function (e) { |
|
|
145 |
showPanel(); |
|
|
146 |
}); |
|
|
147 |
|
|
|
148 |
}); |
|
|
149 |
|
|
|
150 |
</script> |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
</body> |
|
|
154 |
</html> |