Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

5. User Interactions > Hack 46. Make Any Content Draggable Within Your Applicat...

Hack 46. Make Any Content Draggable Within Your Application

Just a few lines of code can turn any item on your page into a draggable item. HTML5 makes drag-and-drop a first-class citizen with easy implementation and brand-new features that help you know exactly what’s going on with your web application.

Gone are the days of writing hundreds of lines of code to allow your users to drag an item from one part of the page to another. HTML5 has capitalized on that idea and brings us a modern version of that age-old interaction. With HTML5 the implementation is easy, and the data around it is rich. Let’s start by looking at how easy it is to make any item on your page draggable:

<div id="myDraggableItem"  draggable=

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint