jQuery排序防止外层div排序成内部div
jQuery Sorting prevent outer div sorted into internal div
到目前为止我有this
$('.sortHolder').sortable({
placeholder: "ui-state-highlight",
connectWith: ".sortHolder",
items : ':not(.noSort)'
});
jQuery('.outer').sortable({
placeholder: "ui-state-highlight",
connectWith: ".outer",
items : ':not(.noSort)'
});
我假设我的 jquery
中遗漏了一件
所以目标是
- 蓝色可以放在 div 内的任何地方
- 绿色不动无法排序
- 灰色只能围绕另一个灰色排序。
- 灰色不能变成绿色或蓝色
这是我的问题,灰色现在可以变成绿色,大灰色可以变成其他灰色,我想要的不是这个功能。这是我现在唯一的问题。我可能遗漏了一些非常简单的东西。
请尝试下面的代码并查看 playground,因为我在 HTML 上也做了一些 类 的更改:https://jsfiddle.net/zks5ojwh/5/
$('.grey').sortable({
placeholder: "ui-state-highlight",
connectWith: ".grey",
items : '.blue'
});
$('.sortHolder').sortable({
placeholder: "ui-state-highlight",
items: '.grey'
});
到目前为止我有this
$('.sortHolder').sortable({
placeholder: "ui-state-highlight",
connectWith: ".sortHolder",
items : ':not(.noSort)'
});
jQuery('.outer').sortable({
placeholder: "ui-state-highlight",
connectWith: ".outer",
items : ':not(.noSort)'
});
我假设我的 jquery
中遗漏了一件所以目标是
- 蓝色可以放在 div 内的任何地方
- 绿色不动无法排序
- 灰色只能围绕另一个灰色排序。
- 灰色不能变成绿色或蓝色
这是我的问题,灰色现在可以变成绿色,大灰色可以变成其他灰色,我想要的不是这个功能。这是我现在唯一的问题。我可能遗漏了一些非常简单的东西。
请尝试下面的代码并查看 playground,因为我在 HTML 上也做了一些 类 的更改:https://jsfiddle.net/zks5ojwh/5/
$('.grey').sortable({
placeholder: "ui-state-highlight",
connectWith: ".grey",
items : '.blue'
});
$('.sortHolder').sortable({
placeholder: "ui-state-highlight",
items: '.grey'
});