diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/examples/dd/constrained-drag.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/examples/dd/constrained-drag.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,339 @@ + + + + + YUI Library Examples: Drag & Drop: Drag Constrained to a Region + + + + + + + + + + + + + + +
+
+
+

+ + YUI 3.x Home - + +

+
+ + +
+ + + +
+
+
+
+

YUI Library Examples: Drag & Drop: Drag Constrained to a Region

+
+
+ +

Note: This is YUI 3.x. Looking for YUI 2.x?

+ +
+
+
+
+ +

Drag & Drop: Drag Constrained to a Region

+ +
+

+

This example shows how to constrain a draggable Node to another Nodes region.

+

+ +
+
+ + + + + + +
+
+
+
1
+
2
+
3
+
+
+
+ + + + + + +
+
+
+ +

Setting up the Node

+

First we need to create the HTML structure used in this example.

+ +

Now we give the Nodes some CSS to make them visible.

+ + +

Setting up the YUI Instance

+

Now we need to create our YUI instance and tell it to load the dd-constrain module (that will load the dd-ddm and dd-drag modules too).

+ + +

Making the Nodes draggable

+

Now that we have a YUI instance with the dd-constrain module, we need to instantiate the Drag instance on the Nodes.

+ + +

Constrain the Nodes to other Nodes

+

Now that we have the Nodes draggable, we need to constrain them. We can do this by plugging the DDConstrained on to the Drag instance and passing it a config option called constrain2node and giving it a selector string of the Node we want to constrain to.

+ +
+ +
+ +
+
+ + + +
+ +
+

Copyright © 2009 Yahoo! Inc. All rights reserved.

+

Privacy Policy - + Terms of Service - + Copyright Policy - + Job Openings

+
+
+ + + +