1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<div class="intro">
<p>This example is the same as the "Drag Delegation with Drop Target" example except we add some plugins.</p>
</div>
<div class="example">
{{>delegate-plugins-source}}
</div>
<h3>Adding Plugins to a Delegate instance</h3>
<p>`DD.Delegate` provides a reference to the `dd` instance so you can plug into the underlying `dd` with `del.dd.plug()`.
This allows you to use DD plugins on a Delegate instance, as well as provides the ability to write plugins for Delegate itself.
</p>
<h3>Constrain Plugin</h3>
<p>Here is how you would add the constrain plugin to a `DD.Delegate` instance.</p>
```
YUI().use('dd-delegate', 'dd-constrain', function(Y) {
var del = new Y.DD.Delegate({
container: '#demo',
nodes: 'li'
});
constrain2node: '#play'
});
});
```
<h3>DDProxy Plugin</h3>
<p>Here is how you would add the dd-proxy plugin to a `DD.Delegate` instance.</p>
```
YUI().use('dd-delegate', 'dd-proxy', function(Y) {
var del = new Y.DD.Delegate({
container: '#demo',
nodes: 'li'
});
moveOnEnd: false,
cloneNode: true
});
});
```
<h3>Full Example Source</h3>
<h4>HTML</h4>
```
{{>delegate-plugins-source-html}}
```
<h4>CSS</h4>
```
{{>delegate-plugins-source-css}}
```
<h4>Javascript</h4>
```
{{>delegate-plugins-source-js}}
```