|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Example: Drag - Interaction Groups</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 |
<a href="#toc" class="jump">Jump to Table of Contents</a> |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
<h1>Example: Drag - Interaction Groups</h1> |
|
|
27 |
<div class="yui3-g"> |
|
|
28 |
<div class="yui3-u-3-4"> |
|
|
29 |
<div id="main"> |
|
|
30 |
<div class="content"><div class="intro"> |
|
|
31 |
<p>This example shows a simple drag interaction that doesn't require a drop interaction.</p> |
|
|
32 |
</div> |
|
|
33 |
|
|
|
34 |
<div class="example"> |
|
|
35 |
<style> |
|
|
36 |
.slot { |
|
|
37 |
border: 2px solid #808080; |
|
|
38 |
background-color: #CDCDCD; |
|
|
39 |
color: #666666; |
|
|
40 |
text-align: center; |
|
|
41 |
position: relative; |
|
|
42 |
float: left; |
|
|
43 |
margin: 4px; |
|
|
44 |
width: 60px; |
|
|
45 |
height: 60px; |
|
|
46 |
z-index: 0; |
|
|
47 |
} |
|
|
48 |
.player { |
|
|
49 |
border: 2px solid #808080; |
|
|
50 |
color: #ffffff; |
|
|
51 |
text-align: center; |
|
|
52 |
position: relative; |
|
|
53 |
float: left; |
|
|
54 |
margin: 4px; |
|
|
55 |
width: 60px; |
|
|
56 |
height: 60px; |
|
|
57 |
top: 150px; |
|
|
58 |
z-index: 1; |
|
|
59 |
cursor: move; |
|
|
60 |
} |
|
|
61 |
#pt1 { |
|
|
62 |
clear: both; |
|
|
63 |
} |
|
|
64 |
.bottom { |
|
|
65 |
top: 50px; |
|
|
66 |
} |
|
|
67 |
|
|
|
68 |
#pt1, #pt2 { |
|
|
69 |
background-color: #71241A; |
|
|
70 |
} |
|
|
71 |
#pb1, #pb2 { |
|
|
72 |
background-color: #004C6D; |
|
|
73 |
} |
|
|
74 |
|
|
|
75 |
#pboth1, #pboth2 { |
|
|
76 |
background-color: #FFA928; |
|
|
77 |
} |
|
|
78 |
|
|
|
79 |
#workarea { |
|
|
80 |
position: relative; |
|
|
81 |
height: 300px; |
|
|
82 |
width: 500px; |
|
|
83 |
} |
|
|
84 |
#workarea .yui3-dd-drop-active-valid { |
|
|
85 |
border: 2px solid green; |
|
|
86 |
} |
|
|
87 |
#workarea .yui3-dd-drop-over { |
|
|
88 |
background-color: green; |
|
|
89 |
} |
|
|
90 |
#workarea .yui3-dd-drop-active-invalid { |
|
|
91 |
border: 2px solid red; |
|
|
92 |
} |
|
|
93 |
|
|
|
94 |
</style> |
|
|
95 |
|
|
|
96 |
<div id="workarea"> |
|
|
97 |
<div class="slot" id="t1">1</div> |
|
|
98 |
<div class="slot bottom" id="b1">3</div> |
|
|
99 |
<div class="slot bottom" id="b2">4</div> |
|
|
100 |
<div class="slot bottom" id="b3">5</div> |
|
|
101 |
<div class="slot bottom" id="b4">6</div> |
|
|
102 |
<div class="slot" id="t2">2</div> |
|
|
103 |
<div class="player" id="pt1">1</div> |
|
|
104 |
<div class="player" id="pt2">2</div> |
|
|
105 |
<div class="player" id="pb1">3</div> |
|
|
106 |
<div class="player" id="pb2">4</div> |
|
|
107 |
<div class="player" id="pboth1">5</div> |
|
|
108 |
<div class="player" id="pboth2">6</div> |
|
|
109 |
</div> |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
<script> |
|
|
114 |
YUI().use('dd-drop', 'dd-proxy', 'dd-constrain', function(Y) { |
|
|
115 |
|
|
|
116 |
var slots = Y.one('#workarea').all('.slot'); |
|
|
117 |
Y.each(slots, function(v, k) { |
|
|
118 |
var id = v.get('id'), groups = ['two']; |
|
|
119 |
switch (id) { |
|
|
120 |
case 't1': |
|
|
121 |
case 't2': |
|
|
122 |
groups = ['one']; |
|
|
123 |
break; |
|
|
124 |
} |
|
|
125 |
var drop = new Y.DD.Drop({ |
|
|
126 |
node: v, |
|
|
127 |
groups: groups |
|
|
128 |
}); |
|
|
129 |
}); |
|
|
130 |
|
|
|
131 |
var players = Y.one('#workarea').all('.player'); |
|
|
132 |
Y.each(players, function(v, k) { |
|
|
133 |
var id = v.get('id'), groups = ['one', 'two']; |
|
|
134 |
switch (id) { |
|
|
135 |
case 'pt1': |
|
|
136 |
case 'pt2': |
|
|
137 |
groups = ['one']; |
|
|
138 |
break; |
|
|
139 |
case 'pb1': |
|
|
140 |
case 'pb2': |
|
|
141 |
groups = ['two']; |
|
|
142 |
break; |
|
|
143 |
} |
|
|
144 |
var drag = new Y.DD.Drag({ |
|
|
145 |
node: v, |
|
|
146 |
groups: groups |
|
|
147 |
}).plug(Y.Plugin.DDProxy, { |
|
|
148 |
moveOnEnd: false |
|
|
149 |
}).plug(Y.Plugin.DDConstrained, { |
|
|
150 |
constrain2node: '#workarea' |
|
|
151 |
}); |
|
|
152 |
drag.on('drag:start', function() { |
|
|
153 |
var p = this.get('dragNode'), |
|
|
154 |
n = this.get('node'); |
|
|
155 |
n.setStyle('opacity', .25); |
|
|
156 |
if (!this._playerStart) { |
|
|
157 |
this._playerStart = this.nodeXY; |
|
|
158 |
} |
|
|
159 |
p.set('innerHTML', n.get('innerHTML')); |
|
|
160 |
p.setStyles({ |
|
|
161 |
backgroundColor: n.getStyle('backgroundColor'), |
|
|
162 |
color: n.getStyle('color'), |
|
|
163 |
opacity: .65 |
|
|
164 |
}); |
|
|
165 |
}); |
|
|
166 |
drag.on('drag:end', function() { |
|
|
167 |
var n = this.get('node'); |
|
|
168 |
n.setStyle('opacity', '1'); |
|
|
169 |
}); |
|
|
170 |
drag.on('drag:drophit', function(e) { |
|
|
171 |
var xy = e.drop.get('node').getXY(); |
|
|
172 |
this.get('node').setXY(xy, Y.UA.ie); |
|
|
173 |
}); |
|
|
174 |
drag.on('drag:dropmiss', function(e) { |
|
|
175 |
if (this._playerStart) { |
|
|
176 |
this.get('node').setXY(this._playerStart, Y.UA.ie); |
|
|
177 |
this._playerStart = null; |
|
|
178 |
} |
|
|
179 |
}); |
|
|
180 |
}); |
|
|
181 |
}); |
|
|
182 |
|
|
|
183 |
|
|
|
184 |
</script> |
|
|
185 |
|
|
|
186 |
</div> |
|
|
187 |
|
|
|
188 |
<h3 id="setting-up-the-work-area">Setting up the Work Area</h3> |
|
|
189 |
<p>First we need to create the work area, players (drags) and slots (drops).</p> |
|
|
190 |
|
|
|
191 |
<pre class="code prettyprint"><div id="workarea"> |
|
|
192 |
<div class="slot" id="t1">1</div> |
|
|
193 |
<div class="slot bottom" id="b1">3</div> |
|
|
194 |
<div class="slot bottom" id="b2">4</div> |
|
|
195 |
<div class="slot bottom" id="b3">5</div> |
|
|
196 |
<div class="slot bottom" id="b4">6</div> |
|
|
197 |
<div class="slot" id="t2">2</div> |
|
|
198 |
<div class="player" id="pt1">1</div> |
|
|
199 |
<div class="player" id="pt2">2</div> |
|
|
200 |
<div class="player" id="pb1">3</div> |
|
|
201 |
<div class="player" id="pb2">4</div> |
|
|
202 |
<div class="player" id="pboth1">5</div> |
|
|
203 |
<div class="player" id="pboth2">6</div> |
|
|
204 |
</div></pre> |
|
|
205 |
|
|
|
206 |
|
|
|
207 |
<p>Now we give them some CSS to make them visible.</p> |
|
|
208 |
|
|
|
209 |
<pre class="code prettyprint">.slot { |
|
|
210 |
border: 2px solid #808080; |
|
|
211 |
background-color: #CDCDCD; |
|
|
212 |
color: #666666; |
|
|
213 |
text-align: center; |
|
|
214 |
position: relative; |
|
|
215 |
float: left; |
|
|
216 |
margin: 4px; |
|
|
217 |
width: 60px; |
|
|
218 |
height: 60px; |
|
|
219 |
z-index: 0; |
|
|
220 |
} |
|
|
221 |
.player { |
|
|
222 |
border: 2px solid #808080; |
|
|
223 |
color: #ffffff; |
|
|
224 |
text-align: center; |
|
|
225 |
position: relative; |
|
|
226 |
float: left; |
|
|
227 |
margin: 4px; |
|
|
228 |
width: 60px; |
|
|
229 |
height: 60px; |
|
|
230 |
top: 150px; |
|
|
231 |
z-index: 1; |
|
|
232 |
cursor: move; |
|
|
233 |
} |
|
|
234 |
#pt1 { |
|
|
235 |
clear: both; |
|
|
236 |
} |
|
|
237 |
.bottom { |
|
|
238 |
top: 50px; |
|
|
239 |
} |
|
|
240 |
|
|
|
241 |
#pt1, #pt2 { |
|
|
242 |
background-color: #71241A; |
|
|
243 |
} |
|
|
244 |
#pb1, #pb2 { |
|
|
245 |
background-color: #004C6D; |
|
|
246 |
} |
|
|
247 |
|
|
|
248 |
#pboth1, #pboth2 { |
|
|
249 |
background-color: #FFA928; |
|
|
250 |
} |
|
|
251 |
|
|
|
252 |
#workarea { |
|
|
253 |
position: relative; |
|
|
254 |
height: 300px; |
|
|
255 |
width: 500px; |
|
|
256 |
} |
|
|
257 |
#workarea .yui3-dd-drop-active-valid { |
|
|
258 |
border: 2px solid green; |
|
|
259 |
} |
|
|
260 |
#workarea .yui3-dd-drop-over { |
|
|
261 |
background-color: green; |
|
|
262 |
} |
|
|
263 |
#workarea .yui3-dd-drop-active-invalid { |
|
|
264 |
border: 2px solid red; |
|
|
265 |
}</pre> |
|
|
266 |
|
|
|
267 |
|
|
|
268 |
<h4 id="setting-up-the-yui-instance">Setting up the YUI Instance</h4> |
|
|
269 |
<p>Now we need to create our YUI instance and tell it to load the <code>dd-drop</code>, <code>dd-proxy</code> and <code>dd-constrain</code> modules.</p> |
|
|
270 |
|
|
|
271 |
<pre class="code prettyprint">YUI().use('dd-drop', 'dd-proxy', 'dd-constrain');</pre> |
|
|
272 |
|
|
|
273 |
|
|
|
274 |
<h4 id="setting-up-the-drop-targets">Setting up the Drop Targets</h4> |
|
|
275 |
<p>Now that we have a YUI instance with the requested modules, we are going to create our Drop Targets.</p> |
|
|
276 |
|
|
|
277 |
<pre class="code prettyprint">YUI().use('dd-drop', 'dd-proxy', 'dd-constrain', function(Y) { |
|
|
278 |
//Get all the nodes with the class of .slot under #workarea |
|
|
279 |
var slots = Y.one('#workarea').all('.slot'); |
|
|
280 |
//Loop through them |
|
|
281 |
Y.each(slots, function(v, k) { |
|
|
282 |
var id = v.get('id'), groups = ['two']; |
|
|
283 |
//Assign them to different groups |
|
|
284 |
switch (id) { |
|
|
285 |
case 't1': |
|
|
286 |
case 't2': |
|
|
287 |
groups = ['one']; |
|
|
288 |
break; |
|
|
289 |
} |
|
|
290 |
//Create the Drop object |
|
|
291 |
var drop = new Y.DD.Drop({ |
|
|
292 |
node: v, |
|
|
293 |
//With the new groups array as a config option |
|
|
294 |
groups: groups |
|
|
295 |
}); |
|
|
296 |
}); |
|
|
297 |
});</pre> |
|
|
298 |
|
|
|
299 |
|
|
|
300 |
<h4 id="setting-up-the-drag-nodes">Setting up the Drag Nodes</h4> |
|
|
301 |
<p>Now we need to create the Drag Nodes and assign them to the proper group.</p> |
|
|
302 |
|
|
|
303 |
<pre class="code prettyprint">YUI().use('dd-drop', 'dd-proxy', 'dd-constrain', function(Y) { |
|
|
304 |
//Snipped |
|
|
305 |
var players = Y.one('#workarea').all('.player'); |
|
|
306 |
Y.each(players, function(v, k) { |
|
|
307 |
var id = v.get('id'), groups = ['one', 'two']; |
|
|
308 |
switch (id) { |
|
|
309 |
case 'pt1': |
|
|
310 |
case 'pt2': |
|
|
311 |
groups = ['one']; |
|
|
312 |
break; |
|
|
313 |
case 'pb1': |
|
|
314 |
case 'pb2': |
|
|
315 |
groups = ['two']; |
|
|
316 |
break; |
|
|
317 |
} |
|
|
318 |
var drag = new Y.DD.Drag({ |
|
|
319 |
node: v, |
|
|
320 |
//Assign the Groups |
|
|
321 |
groups: groups, |
|
|
322 |
//Use Intersect Mode for the Target Calculations |
|
|
323 |
dragMode: 'intersect', |
|
|
324 |
}).plug(Y.Plugin.DDProxy, { |
|
|
325 |
//We don't want the node to move on end drag |
|
|
326 |
moveOnEnd: false |
|
|
327 |
}).plug(Y.Plugin.DDConstrained, { |
|
|
328 |
//Keep me inside the workarea |
|
|
329 |
constrain2node: '#workarea' |
|
|
330 |
}); |
|
|
331 |
});</pre> |
|
|
332 |
|
|
|
333 |
|
|
|
334 |
<h4 id="handling-the-drops-and-moments">Handling the Drops and Moments</h4> |
|
|
335 |
<p>Now we are going to listen for the following Drag Events: <code>drag:start, drag:end, drag:drophit, drag:dropmiss</code></p> |
|
|
336 |
|
|
|
337 |
<pre class="code prettyprint">drag.on('drag:start', function() { |
|
|
338 |
//In this event we setup some styles to make the nodes look pretty |
|
|
339 |
var p = this.get('dragNode'), |
|
|
340 |
n = this.get('node'); |
|
|
341 |
n.setStyle('opacity', .25); |
|
|
342 |
if (!this._playerStart) { |
|
|
343 |
this._playerStart = this.nodeXY; |
|
|
344 |
} |
|
|
345 |
//Put the Drag's HTML inside the proxy |
|
|
346 |
p.set('innerHTML', n.get('innerHTML')); |
|
|
347 |
//set some styles on the proxy |
|
|
348 |
p.setStyles({ |
|
|
349 |
backgroundColor: n.getStyle('backgroundColor'), |
|
|
350 |
color: n.getStyle('color'), |
|
|
351 |
opacity: .65 |
|
|
352 |
}); |
|
|
353 |
}); |
|
|
354 |
drag.on('drag:end', function() { |
|
|
355 |
//Undo some of the styles from the start |
|
|
356 |
var n = this.get('node'); |
|
|
357 |
n.setStyle('opacity', '1'); |
|
|
358 |
}); |
|
|
359 |
drag.on('drag:drophit', function(e) { |
|
|
360 |
//If we drop on a target, move to its position |
|
|
361 |
var xy = e.drop.get('node').getXY(); |
|
|
362 |
this.get('node').setXY(xy); |
|
|
363 |
}); |
|
|
364 |
drag.on('drag:dropmiss', function(e) { |
|
|
365 |
//If we miss a target, move back to our start position |
|
|
366 |
if (this._playerStart) { |
|
|
367 |
this.get('node').setXY(this._playerStart); |
|
|
368 |
this._playerStart = null; |
|
|
369 |
} |
|
|
370 |
});</pre> |
|
|
371 |
|
|
|
372 |
|
|
|
373 |
<h4 id="full-javascript-code">Full Javascript Code</h4> |
|
|
374 |
<pre class="code prettyprint">YUI().use('dd-drop', 'dd-proxy', 'dd-constrain', function(Y) { |
|
|
375 |
|
|
|
376 |
var slots = Y.one('#workarea').all('.slot'); |
|
|
377 |
Y.each(slots, function(v, k) { |
|
|
378 |
var id = v.get('id'), groups = ['two']; |
|
|
379 |
switch (id) { |
|
|
380 |
case 't1': |
|
|
381 |
case 't2': |
|
|
382 |
groups = ['one']; |
|
|
383 |
break; |
|
|
384 |
} |
|
|
385 |
var drop = new Y.DD.Drop({ |
|
|
386 |
node: v, |
|
|
387 |
groups: groups |
|
|
388 |
}); |
|
|
389 |
}); |
|
|
390 |
|
|
|
391 |
var players = Y.one('#workarea').all('.player'); |
|
|
392 |
Y.each(players, function(v, k) { |
|
|
393 |
var id = v.get('id'), groups = ['one', 'two']; |
|
|
394 |
switch (id) { |
|
|
395 |
case 'pt1': |
|
|
396 |
case 'pt2': |
|
|
397 |
groups = ['one']; |
|
|
398 |
break; |
|
|
399 |
case 'pb1': |
|
|
400 |
case 'pb2': |
|
|
401 |
groups = ['two']; |
|
|
402 |
break; |
|
|
403 |
} |
|
|
404 |
var drag = new Y.DD.Drag({ |
|
|
405 |
node: v, |
|
|
406 |
groups: groups |
|
|
407 |
}).plug(Y.Plugin.DDProxy, { |
|
|
408 |
moveOnEnd: false |
|
|
409 |
}).plug(Y.Plugin.DDConstrained, { |
|
|
410 |
constrain2node: '#workarea' |
|
|
411 |
}); |
|
|
412 |
drag.on('drag:start', function() { |
|
|
413 |
var p = this.get('dragNode'), |
|
|
414 |
n = this.get('node'); |
|
|
415 |
n.setStyle('opacity', .25); |
|
|
416 |
if (!this._playerStart) { |
|
|
417 |
this._playerStart = this.nodeXY; |
|
|
418 |
} |
|
|
419 |
p.set('innerHTML', n.get('innerHTML')); |
|
|
420 |
p.setStyles({ |
|
|
421 |
backgroundColor: n.getStyle('backgroundColor'), |
|
|
422 |
color: n.getStyle('color'), |
|
|
423 |
opacity: .65 |
|
|
424 |
}); |
|
|
425 |
}); |
|
|
426 |
drag.on('drag:end', function() { |
|
|
427 |
var n = this.get('node'); |
|
|
428 |
n.setStyle('opacity', '1'); |
|
|
429 |
}); |
|
|
430 |
drag.on('drag:drophit', function(e) { |
|
|
431 |
var xy = e.drop.get('node').getXY(); |
|
|
432 |
this.get('node').setXY(xy, Y.UA.ie); |
|
|
433 |
}); |
|
|
434 |
drag.on('drag:dropmiss', function(e) { |
|
|
435 |
if (this._playerStart) { |
|
|
436 |
this.get('node').setXY(this._playerStart, Y.UA.ie); |
|
|
437 |
this._playerStart = null; |
|
|
438 |
} |
|
|
439 |
}); |
|
|
440 |
}); |
|
|
441 |
});</pre> |
|
|
442 |
|
|
|
443 |
</div> |
|
|
444 |
</div> |
|
|
445 |
</div> |
|
|
446 |
|
|
|
447 |
<div class="yui3-u-1-4"> |
|
|
448 |
<div class="sidebar"> |
|
|
449 |
|
|
|
450 |
<div id="toc" class="sidebox"> |
|
|
451 |
<div class="hd"> |
|
|
452 |
<h2 class="no-toc">Table of Contents</h2> |
|
|
453 |
</div> |
|
|
454 |
|
|
|
455 |
<div class="bd"> |
|
|
456 |
<ul class="toc"> |
|
|
457 |
<li> |
|
|
458 |
<a href="#setting-up-the-work-area">Setting up the Work Area</a> |
|
|
459 |
<ul class="toc"> |
|
|
460 |
<li> |
|
|
461 |
<a href="#setting-up-the-yui-instance">Setting up the YUI Instance</a> |
|
|
462 |
</li> |
|
|
463 |
<li> |
|
|
464 |
<a href="#setting-up-the-drop-targets">Setting up the Drop Targets</a> |
|
|
465 |
</li> |
|
|
466 |
<li> |
|
|
467 |
<a href="#setting-up-the-drag-nodes">Setting up the Drag Nodes</a> |
|
|
468 |
</li> |
|
|
469 |
<li> |
|
|
470 |
<a href="#handling-the-drops-and-moments">Handling the Drops and Moments</a> |
|
|
471 |
</li> |
|
|
472 |
<li> |
|
|
473 |
<a href="#full-javascript-code">Full Javascript Code</a> |
|
|
474 |
</li> |
|
|
475 |
</ul> |
|
|
476 |
</li> |
|
|
477 |
</ul> |
|
|
478 |
</div> |
|
|
479 |
</div> |
|
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
|
483 |
<div class="sidebox"> |
|
|
484 |
<div class="hd"> |
|
|
485 |
<h2 class="no-toc">Examples</h2> |
|
|
486 |
</div> |
|
|
487 |
|
|
|
488 |
<div class="bd"> |
|
|
489 |
<ul class="examples"> |
|
|
490 |
|
|
|
491 |
|
|
|
492 |
<li data-description="A simple drag interaction that doesn't require a drop interaction."> |
|
|
493 |
<a href="simple-drag.html">Simple Drag</a> |
|
|
494 |
</li> |
|
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
<li data-description="How to apply the Drag Plugin to a node."> |
|
|
499 |
<a href="drag-plugin.html">Drag - Node plugin</a> |
|
|
500 |
</li> |
|
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
<li data-description="A simple proxy drag interaction that doesn't require a drop interaction."> |
|
|
505 |
<a href="proxy-drag.html">Drag - Proxy</a> |
|
|
506 |
</li> |
|
|
507 |
|
|
|
508 |
|
|
|
509 |
|
|
|
510 |
<li data-description="How to constrain a draggable Node to another Node's region."> |
|
|
511 |
<a href="constrained-drag.html">Drag - Constrained to a Region</a> |
|
|
512 |
</li> |
|
|
513 |
|
|
|
514 |
|
|
|
515 |
|
|
|
516 |
<li data-description="Using interaction groups, this example demonstrates how to tie into the Drag & Drop Utility's interesting moments to provide visual affordances for the current drag operation."> |
|
|
517 |
<a href="groups-drag.html">Drag - Interaction Groups</a> |
|
|
518 |
</li> |
|
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
|
522 |
<li data-description="The use of the drag shim when dragging nodes over other troublesome nodes."> |
|
|
523 |
<a href="shim-drag.html">Using the Drag Shim</a> |
|
|
524 |
</li> |
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
|
528 |
<li data-description="How to use the Drop Target events to code your application."> |
|
|
529 |
<a href="drop-code.html">Using Drop Based Coding</a> |
|
|
530 |
</li> |
|
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
|
534 |
<li data-description="How you can use the DD Scroll plugin to scroll the browser window as you drag."> |
|
|
535 |
<a href="winscroll.html">Window Scrolling</a> |
|
|
536 |
</li> |
|
|
537 |
|
|
|
538 |
|
|
|
539 |
|
|
|
540 |
<li data-description="How to use DD.Delegate to create a scalable solution which supports multiple draggable items."> |
|
|
541 |
<a href="delegate.html">Drag Delegation</a> |
|
|
542 |
</li> |
|
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
|
546 |
<li data-description="Using DD.Delegate to support dragging multiple items and dropping them onto a Drop Target."> |
|
|
547 |
<a href="delegate-drop.html">Drag Delegation with a Drop Target</a> |
|
|
548 |
</li> |
|
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
<li data-description="How to use Drag plugins with a DD Delegate based solution."> |
|
|
553 |
<a href="delegate-plugins.html">Using Drag Plugins with Delegate</a> |
|
|
554 |
</li> |
|
|
555 |
|
|
|
556 |
|
|
|
557 |
|
|
|
558 |
<li data-description="This example shows how to make a sortable list using Custom Event Bubbling."> |
|
|
559 |
<a href="list-drag.html">List Reorder w/Bubbling</a> |
|
|
560 |
</li> |
|
|
561 |
|
|
|
562 |
|
|
|
563 |
|
|
|
564 |
<li data-description="This example shows how to make a sortable list using Custom Event Bubbling and Node Scrolling."> |
|
|
565 |
<a href="scroll-list.html">List Reorder w/Scrolling</a> |
|
|
566 |
</li> |
|
|
567 |
|
|
|
568 |
|
|
|
569 |
|
|
|
570 |
<li data-description="How to make an animated node a Drop target."> |
|
|
571 |
<a href="anim-drop.html">Animated Drop Targets</a> |
|
|
572 |
</li> |
|
|
573 |
|
|
|
574 |
|
|
|
575 |
|
|
|
576 |
<li data-description="Example Photo Browser application."> |
|
|
577 |
<a href="photo-browser.html">Photo Browser</a> |
|
|
578 |
</li> |
|
|
579 |
|
|
|
580 |
|
|
|
581 |
|
|
|
582 |
<li data-description="Portal style example using Drag & Drop Event Bubbling and Animation."> |
|
|
583 |
<a href="portal-drag.html">Portal Style Example</a> |
|
|
584 |
</li> |
|
|
585 |
|
|
|
586 |
|
|
|
587 |
|
|
|
588 |
|
|
|
589 |
|
|
|
590 |
|
|
|
591 |
</ul> |
|
|
592 |
</div> |
|
|
593 |
</div> |
|
|
594 |
|
|
|
595 |
|
|
|
596 |
|
|
|
597 |
<div class="sidebox"> |
|
|
598 |
<div class="hd"> |
|
|
599 |
<h2 class="no-toc">Examples That Use This Component</h2> |
|
|
600 |
</div> |
|
|
601 |
|
|
|
602 |
<div class="bd"> |
|
|
603 |
<ul class="examples"> |
|
|
604 |
|
|
|
605 |
|
|
|
606 |
|
|
|
607 |
|
|
|
608 |
|
|
|
609 |
|
|
|
610 |
|
|
|
611 |
|
|
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
|
615 |
|
|
|
616 |
|
|
|
617 |
|
|
|
618 |
|
|
|
619 |
|
|
|
620 |
|
|
|
621 |
|
|
|
622 |
|
|
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
|
627 |
|
|
|
628 |
|
|
|
629 |
|
|
|
630 |
|
|
|
631 |
|
|
|
632 |
|
|
|
633 |
|
|
|
634 |
|
|
|
635 |
|
|
|
636 |
|
|
|
637 |
|
|
|
638 |
<li data-description="Working with multiple YUI instances."> |
|
|
639 |
<a href="../yui/yui-multi.html">Multiple Instances</a> |
|
|
640 |
</li> |
|
|
641 |
|
|
|
642 |
|
|
|
643 |
|
|
|
644 |
<li data-description="Use StyleSheet to adjust the CSS rules applying a page theme from user input"> |
|
|
645 |
<a href="../stylesheet/stylesheet-theme.html">Adjusting a Page Theme on the Fly</a> |
|
|
646 |
</li> |
|
|
647 |
|
|
|
648 |
|
|
|
649 |
</ul> |
|
|
650 |
</div> |
|
|
651 |
</div> |
|
|
652 |
|
|
|
653 |
</div> |
|
|
654 |
</div> |
|
|
655 |
</div> |
|
|
656 |
</div> |
|
|
657 |
|
|
|
658 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
659 |
<script>prettyPrint();</script> |
|
|
660 |
|
|
|
661 |
<script> |
|
|
662 |
YUI.Env.Tests = { |
|
|
663 |
examples: [], |
|
|
664 |
project: '../assets', |
|
|
665 |
assets: '../assets/dd', |
|
|
666 |
name: 'groups-drag', |
|
|
667 |
title: 'Drag - Interaction Groups', |
|
|
668 |
newWindow: '', |
|
|
669 |
auto: false |
|
|
670 |
}; |
|
|
671 |
YUI.Env.Tests.examples.push('simple-drag'); |
|
|
672 |
YUI.Env.Tests.examples.push('drag-plugin'); |
|
|
673 |
YUI.Env.Tests.examples.push('proxy-drag'); |
|
|
674 |
YUI.Env.Tests.examples.push('constrained-drag'); |
|
|
675 |
YUI.Env.Tests.examples.push('groups-drag'); |
|
|
676 |
YUI.Env.Tests.examples.push('shim-drag'); |
|
|
677 |
YUI.Env.Tests.examples.push('drop-code'); |
|
|
678 |
YUI.Env.Tests.examples.push('winscroll'); |
|
|
679 |
YUI.Env.Tests.examples.push('delegate'); |
|
|
680 |
YUI.Env.Tests.examples.push('delegate-drop'); |
|
|
681 |
YUI.Env.Tests.examples.push('delegate-plugins'); |
|
|
682 |
YUI.Env.Tests.examples.push('list-drag'); |
|
|
683 |
YUI.Env.Tests.examples.push('scroll-list'); |
|
|
684 |
YUI.Env.Tests.examples.push('anim-drop'); |
|
|
685 |
YUI.Env.Tests.examples.push('photo-browser'); |
|
|
686 |
YUI.Env.Tests.examples.push('portal-drag'); |
|
|
687 |
YUI.Env.Tests.examples.push('yui-multi'); |
|
|
688 |
YUI.Env.Tests.examples.push('stylesheet-theme'); |
|
|
689 |
|
|
|
690 |
</script> |
|
|
691 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
692 |
|
|
|
693 |
|
|
|
694 |
|
|
|
695 |
</body> |
|
|
696 |
</html> |