Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery EasyUI Basic Plugins - Draggable

jQuery EasyUI Basic Plugins - Draggable


jQuery EasyUI Plugins jQuery EasyUI Plugins


Override the default defaults through $.fn.draggable.defaults.

Usage

Create draggable elements through markup.



title

Create draggable elements using javascript.



title


$('#dd').draggable({

    handle:'#title'

});

property

Name Type Description Default value
proxy string,function The proxy element to use while dragging; when set to 'clone', the cloned element will be used as the proxy. If a function is specified, it must return a jQuery object.
 下面的实例演示了如何创建简单的代理对象。     

$('.dragitem').draggable({     proxy: function(source){         var p = $('

');         p.html($(source).html()).appendTo('body');         return p;     } }); | null| onSelect | event | revert | boolean | If set to true, the element returns to its starting position after dragging ends. | false| onSelect | event | cursor | string | The css cursor during dragging. | move| onSelect | event | deltaX | number | The X-axis position of the dragged element relative to the current cursor. | null| onSelect | event | deltaY | number | The Y-axis position of the dragged element relative to the current cursor. | null| onSelect | event | handle | selector | The handle used to start the draggable. | null| onSelect | event | disabled | boolean | If set to true, the draggable is stopped. | false| onSelect | event | edge | number | The drag width within which the draggable can be started. | 0| onSelect | event | axis | string | Defines the axis along which the dragged element can move; valid values are 'v' or 'h'. When set to null, the element moves along both 'v' and 'h' directions. | null |

Events

Name Parameters Description
onBeforeDrag e Fired before dragging; returning false cancels the drag.
onStartDrag e Fired when the target object starts dragging.
onDrag e Fired during dragging. Returning false prevents the actual drag.
onStopDrag e Fired when dragging stops.

Method

Name Parameters Description
options none Return the options property.
proxy none If the proxy property is set, return the drag proxy.
enable none Enable dragging.
disable none Disable dragging.

jQuery EasyUI Plugins jQuery EasyUI Plugins