Chapter 8Drag-and-Drop: Moving Things Around the Screen

The drag-and-drop technology of HTML5 offers ways to take interesting ideas and make them real. For example, can you really put a square peg in a round hole? Probably so with drag-and-drop.

Drag-and-drop works by identifying two types of items: ones that can be dragged and ones that can accept something being dropped on them. A number of events are in play when dragging and dropping happens. Essentially, you provide an attribute to an item (a div, an image, and so on) that makes it draggable. Other elements are set to accept the drop. In other words, a draggable element is dragged to a drop-enabled element.

Along the way in this process are events for when the dragging starts, when the dragging ...

Get HTML5 Multimedia Developer's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.