I remember the excitement I felt after drag-and-drop operations on web pages first became possible with the advent of DHTML and the release of capable browsers. The feeling soon wore off, it was messy, it took an awful lot of code, and browser support was haphazard at best.
Now thanks to the YUI, that same giddy feeling of joy has returned, and this time I can't see the bubble bursting so quickly. Drag-and-drop with Yahoo!'s library is extremely easy to implement. It is completely clean, and cross-compatible with the entire spectrum of A-grade browsers.
We've already had a little exposure to the usefulness of drag-and-drop in previous chapters, as this is the mechanism that allows panels and dialogs to be dragged around the viewport or columns in a DataTable to be resized or reordered (provided the corresponding attributes are enabled). In this chapter, we're going to examine this utility in more detail, we will see:
How to allow any element on the screen...