|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Example: Alternate Skins</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: Alternate Skins</h1> |
|
|
25 |
<div class="yui3-g"> |
|
|
26 |
<div class="yui3-u-3-4"> |
|
|
27 |
<div id="main"> |
|
|
28 |
<div class="content"><style scoped> |
|
|
29 |
#demo .light { |
|
|
30 |
padding: 1em; |
|
|
31 |
} |
|
|
32 |
#demo .dark { |
|
|
33 |
background: #000; |
|
|
34 |
padding: 1em; |
|
|
35 |
} |
|
|
36 |
#demo { |
|
|
37 |
overflow: hidden; |
|
|
38 |
} |
|
|
39 |
/* needed for the chromeless version */ |
|
|
40 |
#demo h4 { |
|
|
41 |
font-weight: normal; |
|
|
42 |
color: #FF8800; |
|
|
43 |
} |
|
|
44 |
#demo h5 { |
|
|
45 |
margin-top: 1em; |
|
|
46 |
text-transform: uppercase; |
|
|
47 |
color: #666; |
|
|
48 |
border-bottom: 1px solid #D9D9D9; |
|
|
49 |
} |
|
|
50 |
</style> |
|
|
51 |
|
|
|
52 |
<div class="intro"> |
|
|
53 |
<p>This example demonstrates the alternate skins available for Slider, and how to apply them.</p> |
|
|
54 |
</div> |
|
|
55 |
|
|
|
56 |
<div class="example"> |
|
|
57 |
<div id="demo"> |
|
|
58 |
<div class="yui3-g"> |
|
|
59 |
<div class="yui3-u-1-2"> |
|
|
60 |
<div class="light"> |
|
|
61 |
<h4>Light skins</h4> |
|
|
62 |
<div class="yui3-skin-sam"> |
|
|
63 |
<h5>Sam skin</h5> |
|
|
64 |
<div id="sam"></div> |
|
|
65 |
</div> |
|
|
66 |
|
|
|
67 |
<div class="yui3-skin-capsule"> |
|
|
68 |
<h5>Capsule skin</h5> |
|
|
69 |
<div id="capsule"></div> |
|
|
70 |
</div> |
|
|
71 |
|
|
|
72 |
<div class="yui3-skin-round"> |
|
|
73 |
<h5>Round skin</h5> |
|
|
74 |
<div id="round"></div> |
|
|
75 |
</div> |
|
|
76 |
|
|
|
77 |
<div class="yui3-skin-audio-light"> |
|
|
78 |
<h5>Audio skin (light)</h5> |
|
|
79 |
<div id="audio_light"></div> |
|
|
80 |
</div> |
|
|
81 |
</div> |
|
|
82 |
</div> |
|
|
83 |
<div class="yui3-u-1-2"> |
|
|
84 |
<div class="dark"> |
|
|
85 |
<h4>Dark skins</h4> |
|
|
86 |
<div class="yui3-skin-sam-dark"> |
|
|
87 |
<h5>Sam skin (dark)</h5> |
|
|
88 |
<div id="sam_dark"></div> |
|
|
89 |
</div> |
|
|
90 |
|
|
|
91 |
<div class="yui3-skin-capsule-dark"> |
|
|
92 |
<h5>Capsule skin (dark)</h5> |
|
|
93 |
<div id="capsule_dark"></div> |
|
|
94 |
</div> |
|
|
95 |
|
|
|
96 |
<div class="yui3-skin-round-dark"> |
|
|
97 |
<h5>Round skin (dark)</h5> |
|
|
98 |
<div id="round_dark"></div> |
|
|
99 |
</div> |
|
|
100 |
|
|
|
101 |
<div class="yui3-skin-audio"> |
|
|
102 |
<h5>Audio skin</h5> |
|
|
103 |
<div id="audio"></div> |
|
|
104 |
</div> |
|
|
105 |
</div> |
|
|
106 |
</div> |
|
|
107 |
</div> |
|
|
108 |
</div> |
|
|
109 |
|
|
|
110 |
<script> |
|
|
111 |
YUI({ |
|
|
112 |
skin: { |
|
|
113 |
overrides: { |
|
|
114 |
'slider-base': [ |
|
|
115 |
'sam', // The default skin |
|
|
116 |
'sam-dark', // Suited for dark backgrounds |
|
|
117 |
|
|
|
118 |
'capsule', // You only need to include one skin |
|
|
119 |
'capsule-dark', // in the overrides section unless you |
|
|
120 |
// are using multiple skins on the same page |
|
|
121 |
'round', |
|
|
122 |
'round-dark', |
|
|
123 |
|
|
|
124 |
'audio-light', |
|
|
125 |
'audio' |
|
|
126 |
] |
|
|
127 |
} |
|
|
128 |
} |
|
|
129 |
}).use('slider', function ( Y ) { |
|
|
130 |
|
|
|
131 |
new Y.Slider().render( '#sam' ); |
|
|
132 |
new Y.Slider().render( '#sam_dark' ); |
|
|
133 |
|
|
|
134 |
new Y.Slider().render( '#capsule' ); |
|
|
135 |
new Y.Slider().render( '#capsule_dark' ); |
|
|
136 |
|
|
|
137 |
new Y.Slider().render( '#round' ); |
|
|
138 |
new Y.Slider().render( '#round_dark' ); |
|
|
139 |
|
|
|
140 |
new Y.Slider().render( '#audio_light' ); |
|
|
141 |
new Y.Slider().render( '#audio' ); |
|
|
142 |
|
|
|
143 |
} ); |
|
|
144 |
</script> |
|
|
145 |
|
|
|
146 |
</div> |
|
|
147 |
|
|
|
148 |
<h3>Specify the skin in the YUI config</h3> |
|
|
149 |
<p> |
|
|
150 |
To access alternate skins for a component, specify an override in the YUI |
|
|
151 |
configuration. The "slider" module is actually a virtual rollup of other |
|
|
152 |
modules, so you need to override the skin for "slider-base". |
|
|
153 |
</p> |
|
|
154 |
|
|
|
155 |
<p>Then just <code>use("slider")</code> as you normally would.</p> |
|
|
156 |
|
|
|
157 |
<pre class="code prettyprint">YUI({ |
|
|
158 |
skin: { |
|
|
159 |
overrides: { |
|
|
160 |
"slider-base": [ "capsule" ] |
|
|
161 |
} |
|
|
162 |
} |
|
|
163 |
}).use( "slider", function (Y) { |
|
|
164 |
... |
|
|
165 |
});</pre> |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
<h3>Use the appropriate skin class in the markup</h3> |
|
|
169 |
<p> |
|
|
170 |
The default skin is the Sam skin. Style YUI components with this skin by |
|
|
171 |
including the class <code>yui3-skin-sam</code> in the class list of an element that |
|
|
172 |
contains the component. Typically, setting <code><body class="yui3-skin-sam"></code> |
|
|
173 |
is good enough. |
|
|
174 |
</p> |
|
|
175 |
|
|
|
176 |
<p> |
|
|
177 |
When overriding the default skin, use a different class on the containing |
|
|
178 |
element. |
|
|
179 |
</p> |
|
|
180 |
|
|
|
181 |
<pre class="code prettyprint"><div class="yui3-skin-round-dark"> |
|
|
182 |
<h5>Round skin (dark)</h5> |
|
|
183 |
<div id="round_dark"><!-- Slider rendered here --></div> |
|
|
184 |
</div></pre> |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
<h3 id="full_code_listing">Full Code Listing</h3> |
|
|
188 |
<p>This is the full code listing for this example.</p> |
|
|
189 |
|
|
|
190 |
<h4>Markup</h4> |
|
|
191 |
<pre class="code prettyprint"><div id="demo"> |
|
|
192 |
<div class="yui3-g"> |
|
|
193 |
<div class="yui3-u-1-2"> |
|
|
194 |
<div class="light"> |
|
|
195 |
<h4>Light skins</h4> |
|
|
196 |
<div class="yui3-skin-sam"> |
|
|
197 |
<h5>Sam skin</h5> |
|
|
198 |
<div id="sam"></div> |
|
|
199 |
</div> |
|
|
200 |
|
|
|
201 |
<div class="yui3-skin-capsule"> |
|
|
202 |
<h5>Capsule skin</h5> |
|
|
203 |
<div id="capsule"></div> |
|
|
204 |
</div> |
|
|
205 |
|
|
|
206 |
<div class="yui3-skin-round"> |
|
|
207 |
<h5>Round skin</h5> |
|
|
208 |
<div id="round"></div> |
|
|
209 |
</div> |
|
|
210 |
|
|
|
211 |
<div class="yui3-skin-audio-light"> |
|
|
212 |
<h5>Audio skin (light)</h5> |
|
|
213 |
<div id="audio_light"></div> |
|
|
214 |
</div> |
|
|
215 |
</div> |
|
|
216 |
</div> |
|
|
217 |
<div class="yui3-u-1-2"> |
|
|
218 |
<div class="dark"> |
|
|
219 |
<h4>Dark skins</h4> |
|
|
220 |
<div class="yui3-skin-sam-dark"> |
|
|
221 |
<h5>Sam skin (dark)</h5> |
|
|
222 |
<div id="sam_dark"></div> |
|
|
223 |
</div> |
|
|
224 |
|
|
|
225 |
<div class="yui3-skin-capsule-dark"> |
|
|
226 |
<h5>Capsule skin (dark)</h5> |
|
|
227 |
<div id="capsule_dark"></div> |
|
|
228 |
</div> |
|
|
229 |
|
|
|
230 |
<div class="yui3-skin-round-dark"> |
|
|
231 |
<h5>Round skin (dark)</h5> |
|
|
232 |
<div id="round_dark"></div> |
|
|
233 |
</div> |
|
|
234 |
|
|
|
235 |
<div class="yui3-skin-audio"> |
|
|
236 |
<h5>Audio skin</h5> |
|
|
237 |
<div id="audio"></div> |
|
|
238 |
</div> |
|
|
239 |
</div> |
|
|
240 |
</div> |
|
|
241 |
</div> |
|
|
242 |
</div></pre> |
|
|
243 |
|
|
|
244 |
|
|
|
245 |
<h4>JavaScript</h4> |
|
|
246 |
<pre class="code prettyprint"><script> |
|
|
247 |
YUI({ |
|
|
248 |
skin: { |
|
|
249 |
overrides: { |
|
|
250 |
'slider-base': [ |
|
|
251 |
'sam', // The default skin |
|
|
252 |
'sam-dark', // Suited for dark backgrounds |
|
|
253 |
|
|
|
254 |
'capsule', // You only need to include one skin |
|
|
255 |
'capsule-dark', // in the overrides section unless you |
|
|
256 |
// are using multiple skins on the same page |
|
|
257 |
'round', |
|
|
258 |
'round-dark', |
|
|
259 |
|
|
|
260 |
'audio-light', |
|
|
261 |
'audio' |
|
|
262 |
] |
|
|
263 |
} |
|
|
264 |
} |
|
|
265 |
}).use('slider', function ( Y ) { |
|
|
266 |
|
|
|
267 |
new Y.Slider().render( '#sam' ); |
|
|
268 |
new Y.Slider().render( '#sam_dark' ); |
|
|
269 |
|
|
|
270 |
new Y.Slider().render( '#capsule' ); |
|
|
271 |
new Y.Slider().render( '#capsule_dark' ); |
|
|
272 |
|
|
|
273 |
new Y.Slider().render( '#round' ); |
|
|
274 |
new Y.Slider().render( '#round_dark' ); |
|
|
275 |
|
|
|
276 |
new Y.Slider().render( '#audio_light' ); |
|
|
277 |
new Y.Slider().render( '#audio' ); |
|
|
278 |
|
|
|
279 |
} ); |
|
|
280 |
</script></pre> |
|
|
281 |
|
|
|
282 |
|
|
|
283 |
</div> |
|
|
284 |
</div> |
|
|
285 |
</div> |
|
|
286 |
|
|
|
287 |
<div class="yui3-u-1-4"> |
|
|
288 |
<div class="sidebar"> |
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
<div class="sidebox"> |
|
|
293 |
<div class="hd"> |
|
|
294 |
<h2 class="no-toc">Examples</h2> |
|
|
295 |
</div> |
|
|
296 |
|
|
|
297 |
<div class="bd"> |
|
|
298 |
<ul class="examples"> |
|
|
299 |
|
|
|
300 |
|
|
|
301 |
<li data-description="The basics of setting up a horizontal and vertical Slider"> |
|
|
302 |
<a href="slider-basic.html">Basic Sliders</a> |
|
|
303 |
</li> |
|
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
<li data-description="Creating a vertical Slider from existing markup"> |
|
|
308 |
<a href="slider-from-markup.html">Creating a Slider from Existing Markup</a> |
|
|
309 |
</li> |
|
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
|
313 |
<li data-description="Specifying an alternate skin for a Slider instance"> |
|
|
314 |
<a href="slider-skin.html">Alternate Skins</a> |
|
|
315 |
</li> |
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
|
330 |
</ul> |
|
|
331 |
</div> |
|
|
332 |
</div> |
|
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
|
336 |
<div class="sidebox"> |
|
|
337 |
<div class="hd"> |
|
|
338 |
<h2 class="no-toc">Examples That Use This Component</h2> |
|
|
339 |
</div> |
|
|
340 |
|
|
|
341 |
<div class="bd"> |
|
|
342 |
<ul class="examples"> |
|
|
343 |
|
|
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
|
351 |
<li data-description="Use three sliders to control RGB values and update Hex and HSL strings."> |
|
|
352 |
<a href="../color/rgb-slider.html">RGB Slider</a> |
|
|
353 |
</li> |
|
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
|
357 |
<li data-description="Use the HSL color picker to select a new color. Then chose the color type you like best."> |
|
|
358 |
<a href="../color/hsl-picker.html">HSL Color Picker</a> |
|
|
359 |
</li> |
|
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
|
363 |
<li data-description="Use the HSL color picker to create harmony colors."> |
|
|
364 |
<a href="../color/hsl-harmony.html">HSL Harmony</a> |
|
|
365 |
</li> |
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
<li data-description="Shows how to use Overlay's constrainment support, to limit the XY value which can be set for an Overlay."> |
|
|
370 |
<a href="../overlay/overlay-constrain.html">Constrain Support</a> |
|
|
371 |
</li> |
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
<li data-description="Use StyleSheet to adjust the CSS rules applying a page theme from user input"> |
|
|
376 |
<a href="../stylesheet/stylesheet-theme.html">Adjusting a Page Theme on the Fly</a> |
|
|
377 |
</li> |
|
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
|
381 |
<li data-description="Example Photo Browser application."> |
|
|
382 |
<a href="../dd/photo-browser.html">Photo Browser</a> |
|
|
383 |
</li> |
|
|
384 |
|
|
|
385 |
|
|
|
386 |
</ul> |
|
|
387 |
</div> |
|
|
388 |
</div> |
|
|
389 |
|
|
|
390 |
</div> |
|
|
391 |
</div> |
|
|
392 |
</div> |
|
|
393 |
</div> |
|
|
394 |
|
|
|
395 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
396 |
<script>prettyPrint();</script> |
|
|
397 |
|
|
|
398 |
<script> |
|
|
399 |
YUI.Env.Tests = { |
|
|
400 |
examples: [], |
|
|
401 |
project: '../assets', |
|
|
402 |
assets: '../assets/slider', |
|
|
403 |
name: 'slider-skin', |
|
|
404 |
title: 'Alternate Skins', |
|
|
405 |
newWindow: '', |
|
|
406 |
auto: false |
|
|
407 |
}; |
|
|
408 |
YUI.Env.Tests.examples.push('slider-basic'); |
|
|
409 |
YUI.Env.Tests.examples.push('slider-from-markup'); |
|
|
410 |
YUI.Env.Tests.examples.push('slider-skin'); |
|
|
411 |
YUI.Env.Tests.examples.push('rgb-slider'); |
|
|
412 |
YUI.Env.Tests.examples.push('hsl-picker'); |
|
|
413 |
YUI.Env.Tests.examples.push('hsl-harmony'); |
|
|
414 |
YUI.Env.Tests.examples.push('overlay-constrain'); |
|
|
415 |
YUI.Env.Tests.examples.push('stylesheet-theme'); |
|
|
416 |
YUI.Env.Tests.examples.push('photo-browser'); |
|
|
417 |
|
|
|
418 |
</script> |
|
|
419 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
420 |
|
|
|
421 |
|
|
|
422 |
|
|
|
423 |
</body> |
|
|
424 |
</html> |