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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.