From 77db51ef9d9fbe284d1943bdae6ae1b1f404ed0a Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Wed, 31 Jan 2024 16:33:34 +0800 Subject: [PATCH] =?UTF-8?q?08sortable.js=20filter=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=88=96=E5=BF=BD=E7=95=A5=E6=8C=87=E5=AE=9A=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08sortable.js filter 过滤或忽略指定元素.html | 72 ++++++++++++++++++++ temp.js | 11 ++- 2 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 08sortable.js filter 过滤或忽略指定元素.html diff --git a/08sortable.js filter 过滤或忽略指定元素.html b/08sortable.js filter 过滤或忽略指定元素.html new file mode 100644 index 0000000..a26063b --- /dev/null +++ b/08sortable.js filter 过滤或忽略指定元素.html @@ -0,0 +1,72 @@ + + + + + + sortable.js filter属性例子 + + + + + + +
+
+
item 2 无法被拖动 class包含了filter类
+
+ item 1 +
+
+ item 2 +
+
+ item 3 +
+
+
+
+ + + + \ No newline at end of file diff --git a/temp.js b/temp.js index 76e859b..56a7881 100644 --- a/temp.js +++ b/temp.js @@ -1,16 +1,15 @@ +var g1 = document.getElementById('g1'); var ops1 = { animation: 1000, + delay: 30, draggable: '.item', - handle: '.move', + filter: '.filter', //拖动结束 onEnd: function (evt) { console.log(evt); //获取拖动后的排序 - var arr = sortable.toArray(); + var arr = sortable1.toArray(); document.getElementById('msg').innerHTML = 'A组排序结果:' + JSON.stringify(arr); }, }; -function del() { - console.log('执行了del事件'); -} -var sortable = Sortable.create(g1, ops1); +var sortable1 = Sortable.create(g1, ops1);