国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jquery sortable的拖動方法示例詳解

2019-11-20 21:14:18
字體:
來源:轉載
供稿:網友
所有的事件回調函數都有兩個參數:event和ui,瀏覽器自有event對象,和經過封裝的ui對象
ui.helper - 表示sortable元素的JQuery對象,通常是當前元素的克隆對象
ui.position - 表示相對當前對象,鼠標的坐標值對象{top,left}
ui.offset - 表示相對于當前頁面,鼠標的坐標值對象{top,left}
ui.item - 表示當前拖拽的元素
ui.placeholder - 占位符(如果有定義的話)
ui.sender - 當前拖拽元素的所屬sortable對象(僅當元素是從另一個sortable對象傳遞過來時有用)

?參數(參數名 : 參數類型 : 默認值)
appendTo : String : 'parent'
Defines where the helper that moves with the mouse is being appended to during the drag (for example, to resolve overlap/zIndex issues).
初始:$('.selector').sortable({ appendTo: 'body' });
獲取:var appendTo = $('.selector').sortable('option', 'appendTo');
設置:$('.selector').sortable('option', 'appendTo', 'body');

axis : String : false
如果有設置,則元素僅能橫向或縱向拖動。可選值:'x', 'y'
初始:$('.selector').sortable({ axis: 'x' });
獲取:var axis = $('.selector').sortable('option', 'axis');
設置:$('.selector').sortable('option', 'axis', 'x');

cancel : Selector : ':input,button'
阻止排序動作在匹配的元素上發(fā)生。
初始:$('.selector').sortable({ cancel: 'button' });
獲取:var cancel = $('.selector').sortable('option', 'cancel');
設置:$('.selector').sortable('option', 'cancel', 'button');

connectWith : Selector : false
允許sortable對象連接另一個sortable對象,可將item元素拖拽到另一個中。
初始:$('.selector').sortable({ connectWith: '.otherlist' });
獲取:var connectWith = $('.selector').sortable('option', 'connectWith');
設置:$('.selector').sortable('option', 'connectWith', '.otherlist');

containment : Element, String, Selector : false
約束排序動作只能在一個指定的范圍內發(fā)生。可選值:DOM對象, 'parent', 'document', 'window', 或jQuery對象
初始:$('.selector').sortable({ containment: 'parent' });
獲取:var containment = $('.selector').sortable('option', 'containment');
設置:$('.selector').sortable('option', 'containment', 'parent');

cursor : String : 'auto'
定義在開始排序動作時,如果的樣式。
初始:$('.selector').sortable({ cursor: 'crosshair' });
獲取:var cursor = $('.selector').sortable('option', 'cursor');
設置:$('.selector').sortable('option', 'cursor', 'crosshair');

cursorAt : Object : false
當開始移動時,鼠標定位在的某個位置上(最多兩個方向)。可選值:{ top, left, right, bottom }.
初始:$('.selector').sortable({ cursorAt: 'top' });
獲取:var cursorAt = $('.selector').sortable('option', 'cursorAt');
設置:$('.selector').sortable('option', 'cursorAt', 'top');

delay : Integer : 0
以毫秒為單位,設置延遲多久才激活排序動作。此參數可防止誤點擊。
初始:$('.selector').sortable({ delay: 500 });
獲取:var delay = $('.selector').sortable('option', 'delay');
設置:$('.selector').sortable('option', 'delay', 500);

distance : Integer : 1
決定至少要在元素上面拖動多少像素后,才正式觸發(fā)排序動作。
初始:$('.selector').sortable({ distance: 30 });
獲取:var distance = $('.selector').sortable('option', 'distance');
設置:$('.selector').sortable('option', 'distance', 30);

dropOnEmpty : Boolean : true
是否允 主站蜘蛛池模板: 海丰县| 安康市| 临海市| 额济纳旗| 隆昌县| 馆陶县| 茂名市| 海林市| 阳谷县| 阜康市| 阿拉尔市| 霞浦县| 武陟县| 濮阳县| 池州市| 海城市| 子长县| 子洲县| 庆元县| 额敏县| 磐石市| 南充市| 花垣县| 宜昌市| 东乡| 泉州市| 灵川县| 贞丰县| 通河县| 金华市| 长丰县| 赤峰市| 岢岚县| 友谊县| 刚察县| 白玉县| 乌恰县| 五峰| 广丰县| 崇阳县| 东山县|