如何使用 sortable.js 库对列表进行排序? https://sortablejs.github.io/Sortable/
我在 tr 属性上设置了 sortable_container(sortable_emploees id) 。这很好用。但如何同时对tbody中的td进行排序呢?
请看gif。 Tbody 不可排序。如何创建表格以拖放标题单元格和正文单元格。或者如何设置 sortable.js 来为我做到这一点?
检查示例代码:
const el = document.getElementById('sortable_employees');
const sortable = new Sortable(el, {
animation: 150,
ghostClass: 'bg-blue-200',
});
https://jsfiddle.net/mateuszbialowas/ds5bfj7v/27/
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
您可以尝试这种 div 方法。
https://codepen.io/jlapinski/pen/ZXYERN