编程那点事编程那点事

专注编程入门及提高
探究程序员职业规划之道!

easyui api中文文档:Draggable

可拖动的(Draggable)

用$.fn.draggable.defaults重写defaults

使用示例(Usage Example)

通过标记创建一个可拖动的的元素
title
通过javascript创建一个可拖动的元素
title
$('#dd').draggable({
    handle:'#title'
},2);

属性(Properties)

Name Type Description Default

proxy

string,function

拖拽时候的代理元素,当被设置成’clone’的时候,一个克隆的元素作为代理,如果函数是指定的,则他必须返回一个jquery对象。

下面的例子展示了怎么创建一个简单的代理对象:

$('.dragitem').draggable({

?????????????? proxy: function(source){

?????????????????????????????? var p = $('

',2);


?????????????????????????????? p.html($(source).html()).appendTo('body',2);

?????????????????????????????? return p;

?????????????? }

},2);

null

revert

boolean

如果设置为true的话,元素拖拽停止的时候,他将返回他的出事位置。

false

cursor

string

拖拽时的鼠标样式。

move

deltaX

number

拖动元素的X位置对应到当前光标

null

deltaY

number

拖动元素的Y位置对应到当前光标

null

handle

selector

开始拖动的手柄

null

disabled

boolean

设置为true的时候,停止拖拽

false

edge

number

The drag width in which can start draggable.

能拖动的宽度

0

axis

string

Defines the axis which the dragged elements moves on, available value is 'v' or 'h', when set to null will move across 'v' and 'h' direction.

可拖动元素能移动的轴线

null

事件(Events)

Name Parameters Description
onBeforeDrag e 拖动前触发,返回false的时候停止拖动
onStartDrag e 目标对象开始拖动的时候触发
onDrag e 在拖动过程中触发
onStopDrag e 停止拖动是触发

方法(Methods)

Name Parameters Description
options none 返回选择属性
proxy none 如果代理属性被设置的话则返回代理属性
enable none 使可拖动
disable none 禁用拖动
未经允许不得转载: 技术文章 » javascript » easyui api中文文档:Draggable