The drag-and-drop function is implemented for the script div (two types ).
There are many drag operations on the webpage, such as dragging the tree list and dragging images.
1. Native drag-and-drop implementation
<! Doctype html>
2 jQuery UI draggable
You are responsible for implementing the drag Method on your own. jQuery UI provides drag-and-drop events that allow you to easily add drag effects to a div.
JQuery UI mainly implements the drag function through the draggable event.
<Script> $ (document ). ready (function (e) {$ ('. drag '). draggable ({cursor: 'move '}); $ (' # enable '). click (function (e) {$ ('. drag '). draggable ('enable');}); $ ('# disable '). click (function (event) {$ ('. drag '). draggable ('disable');}); $ ('# deatroy '). click (function (event) {$ ('. drag '). draggable ('deststroy ');});}) </script>
For more information about draggable APIs, see draggalbe APIs.
Draggable instance
The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!