First, the definition
- drag-and-drop is a common feature that grabs an object and then drags it to another location. in HTML5, drag-and-drop is part of the standard, and any element can be dragged and dropped.
- Internet Explorer + +, Firefox, Opera, Chrome, and Safari support drag. Safari 5.1.2 does not support dragging
Second, use
Set element to drag and drop: Set the Draggable property to true in order for the element to be dragged
Drag what: Ondragstart and SetData (), where ondragstart it specifies the data to be dragged. The SetData () method sets the data type and value of the dragged data.
where to put: The OnDragOver event specifies where to place the dragged data. By default, data/elements cannot be placed in other elements. If you need to set allow placement, we must block the default handling of elements.
This is done by calling the Event.preventdefault () method of the OnDragOver event
To place: OnDrop A drop event occurs when the dragged data is placed.
Third, the case
HTML5 drag and drop (Drag and drop)