首页技术文档JQuery › 个人JQuery学习笔记—Sortable,表格拖动排序

个人JQuery学习笔记—Sortable,表格拖动排序

使用Jqery实现类似igoogle的功能是很方便的。使用sortable方式实现。其中有一些参数很重要:

appendTo: ‘parent’ 覆盖于父子节,防止鼠标拖拽时被遮挡

axis: false 仅限制于X/Y轴移动

cancel: ‘:input,button’ 当拖拽匹配元素时,阻止拖拽

connectWith: false 允许此 sortable 拖拽至其他 sortable

containment: false 允许拖拽的范围

cursor: ‘auto’ 拖拽时的鼠标标示

delay: 1 多少毫秒后激活拖拽动作

distance: 1 拖拽多少像素后激活拖拽动作

dropOnEmpty: true 当 sortable 中元素被拖空后,将不能再往里放元素

change:fn 改变时候的执行的方法

update: fn WEB2.0自定义保存方法

handle: ‘.header’ 很重要,可以拖动的位置

Javascript 代码
$(function(){
$(“.colunm”).sortable({connectWith:’.colunm’,handle: ‘.header’});
});

本站技术交流群:24735919,欢迎大家进群交流探讨!

发表评论