Overrides the default defaults with $.fn.draggable.defaults.
Usage
Copy Code code as follows:
<div id= "dd" style= "width:100px;height:100px;" >
<div id= "title" style= "background: #ccc;" >title</div>
</div>
Copy Code code as follows:
$ (' #dd '). Draggable ({
Handle: ' #title '
});
Characteristics
Name |
Type |
Description |
Default value |
Proxy |
String,function |
The proxy element to use when dragging, when set to ' clone ' , the clone element will be used as the proxy. If you specify a function, it must return a jQuery object. |
Null |
Revert |
Boolean |
If set to true, the element will return to its starting position when the drag ends. |
False |
Cursor |
String |
Drag-and-drop CSS cursor (cursor). |
Move |
DeltaX |
Number |
The X that drags the element relative to the position of the current cursor . |
Null |
DeltaY |
Number |
The Y of the dragged element relative to the position of the current cursor . |
Null |
Handle |
Selector |
Initiates the processing of draggable (handle). |
Null |
Disabled |
Boolean |
Set to true to stop draggable. |
False |
Edge |
Number |
Be able to start draggable in them. Drag-and-drop width. |
0 |
Axis |
String |
Defines the axis on which the dragged element can be moved, the available value is ' V ' or ' H ', and when set to null, it moves along the direction of ' V ' and ' H ' . |
Null |
Event
Name |
Parameters |
Description |
Onbeforedrag |
E |
Drag before triggering, return false to cancel drag. |
Onstartdrag |
E |
Triggered when the target object starts dragging. |
Ondrag |
E |
Drag-and-drop period triggered. Return false will not do real drag. |
Onstopdrag |
E |
Drag to trigger when stopping. |
Method
Name |
Parameters |
Describe |
Options |
None |
Returns the optionsproperty. |
Proxy |
None |
Returns the proxy if theProxyproperty is set. |
Enable |
None |
Enable drag and drop actions. . |
Disable |
None |
Disables drag and drop actions. |