YUI 3.x Home -

YUI Library Examples: Drag & Drop: Interaction Groups

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

Drag & Drop: Interaction Groups

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.

1
3
4
5
6
2
1
2
3
4
5
6

Setting up the Work Area

First we need to create the work area, players (drags) and slots (drops).

Now we give them 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-drop, dd-proxy and dd-constrain modules.

Setting up the Drop Targets

Now that we have a YUI instance with the requested modules, we are going to create our Drop Targets.

Setting up the Drag Nodes

Now we need to create the Drag Nodes and assign them to the proper group.

Handling the Drops and Moments

Now we are going to listen for Four Drag Events: drag:start, drag:end, drag:drophit, drag:dropmiss

Full Javascript Code

Copyright © 2009 Yahoo! Inc. All rights reserved.

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