Home >Web Front-end >H5 Tutorial >Getting Started Tutorial on Drag and Drop Events
Preface HTML5 provides a direct drag-and-drop API, which greatly facilitates us to achieve drag-and-drop effects. We do not need to write a lot of js. We only need to listen to the drag-and-drop events of elements to achieve various drag-and-drops. Function. If you want to drag and drop an element, you must set the draggable attribute of the element to true. When this attribute is false, draggable will not be allowed. Both the img element and the a element have the draggable attribute set to true by default, so they can be dragged and dropped directly. If you do not want to drag and drop these two elements, just set the attribute to false. Drag and Drop Events Drag and drop events are generated by different elements. When an element is dragged and dropped, it may pass through many elements before finally reaching the element you want to place. Here, I temporarily call the dragged element the source object, the passed element the process object, and the arrived element the target object. Different objects generate different drag and drop events. Source object: dragstart: The source object starts dragging. drag: During the drag and drop process of the source object. dragend: The drag and drop of the source object ends. Process object: dragenter: The source object begins to enter the scope of the process object. dr
1. Drag and drop API implements drag and drop sorting
##Introduction: Foreword HTML5 provides a direct drag and drop API, which greatly facilitates us to achieve drag and drop effects. We do not need to write a lot of js. We only need to listen to the drag and drop events of elements to achieve various drag and drop events. release function.
2. HTML5 drag and drop About API implementation of drag and drop sorting example code
##Introduction: HTML5 provides a direct drag-and-drop API, which greatly facilitates us to achieve the drag-and-drop effect. We do not need to write a lot of js, we only need to listen to the drag-and-drop event of the element. Various drag and drop functions can be realized.
3.
HTML5 Advanced Tutorial--Drag-and-drop API to implement drag-and-drop sorting
Introduction: Foreword HTML5 provides a direct drag-and-drop API, which greatly facilitates us to achieve the drag-and-drop effect. We do not need to write a lot of js, we only need to monitor the drag-and-drop of elements. Events can implement various drag-and-drop functions.
4.
Detailed explanation of drag and drop events (Drag and drop) in HTML5
Introduction: The browser supports Internet Explorer 9, Firefox, Opera 12, Chrome and Safari 5. It supports drag and drop. Note: Drag and drop is not supported in Safari 5.1.2. HTML5 drag and drop example