|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Example: Showing and Hiding with Transitions</title> |
|
|
6 |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic"> |
|
|
7 |
<link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css"> |
|
|
8 |
<link rel="stylesheet" href="../assets/css/main.css"> |
|
|
9 |
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> |
|
|
10 |
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> |
|
|
11 |
<script src="../../build/yui/yui-min.js"></script> |
|
|
12 |
|
|
|
13 |
</head> |
|
|
14 |
<body> |
|
|
15 |
<!-- |
|
|
16 |
<a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a> |
|
|
17 |
--> |
|
|
18 |
<div id="doc"> |
|
|
19 |
<div id="hd"> |
|
|
20 |
<h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1> |
|
|
21 |
</div> |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
<h1>Example: Showing and Hiding with Transitions</h1> |
|
|
25 |
<div class="yui3-g"> |
|
|
26 |
<div class="yui3-u-3-4"> |
|
|
27 |
<div id="main"> |
|
|
28 |
<div class="content"><style scoped> |
|
|
29 |
div.demo { |
|
|
30 |
margin: 1em 0; |
|
|
31 |
width: 300px; |
|
|
32 |
background-color: #B6BFDA; |
|
|
33 |
border: 1px solid #7E869D; |
|
|
34 |
box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.25); |
|
|
35 |
border-radius: 3px; |
|
|
36 |
} |
|
|
37 |
|
|
|
38 |
div.demo p { |
|
|
39 |
padding: 1em; |
|
|
40 |
zoom:1; |
|
|
41 |
} |
|
|
42 |
</style> |
|
|
43 |
<div class="intro"> |
|
|
44 |
<p>This example shows how to show and hide Node instances.</p> |
|
|
45 |
</div> |
|
|
46 |
|
|
|
47 |
<div class="example"> |
|
|
48 |
<button id="hide" class="yui3-button">hide</button> |
|
|
49 |
<button id="show" class="yui3-button">show</button> |
|
|
50 |
|
|
|
51 |
<div class="demo"><p>lorem ipsum dolor sit</p></div> |
|
|
52 |
|
|
|
53 |
<script type="text/javascript"> |
|
|
54 |
YUI().use('transition', 'node-event-delegate', 'cssbutton', function(Y) { |
|
|
55 |
Y.delegate('click', function(e) { |
|
|
56 |
var buttonID = e.currentTarget.get('id'), |
|
|
57 |
node = Y.one('.demo'); |
|
|
58 |
|
|
|
59 |
if (buttonID === 'show') { |
|
|
60 |
node.show(true); |
|
|
61 |
} else if (buttonID == 'hide') { |
|
|
62 |
node.hide(true); |
|
|
63 |
} |
|
|
64 |
|
|
|
65 |
}, document, 'button'); |
|
|
66 |
}); |
|
|
67 |
</script> |
|
|
68 |
|
|
|
69 |
</div> |
|
|
70 |
|
|
|
71 |
<h2>Showing a Node</h2> |
|
|
72 |
<p>The view of a Node instance can be transitioned by passing <code>true</code> to the <code>show</code> and <code>hide</code> methods.</p> |
|
|
73 |
|
|
|
74 |
<pre class="code prettyprint">Y.one('.demo').show(true);</pre> |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
<h2>Hiding a Node</h2> |
|
|
78 |
<p>The opposite of <code>show</code>, the <code>hide</code> method sets the node's CSS <code>display</code> property to <code>none</code>.</p> |
|
|
79 |
|
|
|
80 |
<pre class="code prettyprint">Y.one('.demo').hide(true);</pre> |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
<h2>Complete Example Source</h2> |
|
|
84 |
<pre class="code prettyprint"><button id="hide" class="yui3-button">hide</button> |
|
|
85 |
<button id="show" class="yui3-button">show</button> |
|
|
86 |
|
|
|
87 |
<div class="demo"><p>lorem ipsum dolor sit</p></div> |
|
|
88 |
|
|
|
89 |
<script type="text/javascript"> |
|
|
90 |
YUI().use('transition', 'node-event-delegate', 'cssbutton', function(Y) { |
|
|
91 |
Y.delegate('click', function(e) { |
|
|
92 |
var buttonID = e.currentTarget.get('id'), |
|
|
93 |
node = Y.one('.demo'); |
|
|
94 |
|
|
|
95 |
if (buttonID === 'show') { |
|
|
96 |
node.show(true); |
|
|
97 |
} else if (buttonID == 'hide') { |
|
|
98 |
node.hide(true); |
|
|
99 |
} |
|
|
100 |
|
|
|
101 |
}, document, 'button'); |
|
|
102 |
}); |
|
|
103 |
</script></pre> |
|
|
104 |
|
|
|
105 |
</div> |
|
|
106 |
</div> |
|
|
107 |
</div> |
|
|
108 |
|
|
|
109 |
<div class="yui3-u-1-4"> |
|
|
110 |
<div class="sidebar"> |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
<div class="sidebox"> |
|
|
115 |
<div class="hd"> |
|
|
116 |
<h2 class="no-toc">Examples</h2> |
|
|
117 |
</div> |
|
|
118 |
|
|
|
119 |
<div class="bd"> |
|
|
120 |
<ul class="examples"> |
|
|
121 |
|
|
|
122 |
|
|
|
123 |
<li data-description="Demonstrates the basic usage of Transitions."> |
|
|
124 |
<a href="transition-basic.html">Basic Node Transitions</a> |
|
|
125 |
</li> |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
<li data-description="Demonstrates more advanced usage of Transitions."> |
|
|
130 |
<a href="transition-usage.html">Using Transitions</a> |
|
|
131 |
</li> |
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
<li data-description="Demonstrates how to animate Node's show and hide methods."> |
|
|
136 |
<a href="transition-view.html">Showing and Hiding with Transitions</a> |
|
|
137 |
</li> |
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
</ul> |
|
|
155 |
</div> |
|
|
156 |
</div> |
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
<div class="sidebox"> |
|
|
161 |
<div class="hd"> |
|
|
162 |
<h2 class="no-toc">Examples That Use This Component</h2> |
|
|
163 |
</div> |
|
|
164 |
|
|
|
165 |
<div class="bd"> |
|
|
166 |
<ul class="examples"> |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
<li data-description="Shows how to create a panel that animates as it is shown and hidden"> |
|
|
176 |
<a href="../panel/panel-animate.html">Creating an Animated Panel</a> |
|
|
177 |
</li> |
|
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
|
181 |
<li data-description="This example employs AsyncQueue to incrementally construct an application interface; this illustrates the approach you'd take to allow chunked rendering of the UI in a process-intensive application."> |
|
|
182 |
<a href="../async-queue/queue-app.html">Building a UI with AsyncQueue</a> |
|
|
183 |
</li> |
|
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
|
187 |
<li data-description="Extend the Promise class to create your own Node plugin that chains transitions"> |
|
|
188 |
<a href="../promise/plugin-example.html">Creating a Node Plugin that chains transitions</a> |
|
|
189 |
</li> |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
<li data-description="Create a reusable JSONPRequest object to poll the YUILibrary.com Gallery web service, fetching info on a random Gallery module."> |
|
|
194 |
<a href="../jsonp/jsonp-gallery.html">Reusing a JSONPRequest Instance to Poll a Remote Server</a> |
|
|
195 |
</li> |
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
<li data-description="NodeList provides Node functionality for manipulating multiple nodes at once."> |
|
|
200 |
<a href="../node/nodelist.html">Using NodeList - Simple</a> |
|
|
201 |
</li> |
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
<li data-description="How to use multiple NodeList features to build a simple game."> |
|
|
206 |
<a href="../node/ducks.html">Using NodeList - Ducks Game</a> |
|
|
207 |
</li> |
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
<li data-description="This example demonstrates how to insert content into a Node."> |
|
|
212 |
<a href="../node/node-insert.html">Adding Node Content - Burger Builder</a> |
|
|
213 |
</li> |
|
|
214 |
|
|
|
215 |
|
|
|
216 |
</ul> |
|
|
217 |
</div> |
|
|
218 |
</div> |
|
|
219 |
|
|
|
220 |
</div> |
|
|
221 |
</div> |
|
|
222 |
</div> |
|
|
223 |
</div> |
|
|
224 |
|
|
|
225 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
226 |
<script>prettyPrint();</script> |
|
|
227 |
|
|
|
228 |
<script> |
|
|
229 |
YUI.Env.Tests = { |
|
|
230 |
examples: [], |
|
|
231 |
project: '../assets', |
|
|
232 |
assets: '../assets/transition', |
|
|
233 |
name: 'transition-view', |
|
|
234 |
title: 'Showing and Hiding with Transitions', |
|
|
235 |
newWindow: '', |
|
|
236 |
auto: false |
|
|
237 |
}; |
|
|
238 |
YUI.Env.Tests.examples.push('transition-basic'); |
|
|
239 |
YUI.Env.Tests.examples.push('transition-usage'); |
|
|
240 |
YUI.Env.Tests.examples.push('transition-view'); |
|
|
241 |
YUI.Env.Tests.examples.push('panel-animate'); |
|
|
242 |
YUI.Env.Tests.examples.push('queue-app'); |
|
|
243 |
YUI.Env.Tests.examples.push('plugin-example'); |
|
|
244 |
YUI.Env.Tests.examples.push('jsonp-gallery'); |
|
|
245 |
YUI.Env.Tests.examples.push('nodelist'); |
|
|
246 |
YUI.Env.Tests.examples.push('ducks'); |
|
|
247 |
YUI.Env.Tests.examples.push('node-insert'); |
|
|
248 |
|
|
|
249 |
</script> |
|
|
250 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
</body> |
|
|
255 |
</html> |