[英]jQueryUI - dragging element in table issue
I am using jqueryui to create a custom scheduler, but there is an issue with drag/drop events.我正在使用 jqueryui 创建自定义调度程序,但拖放事件存在问题。 If I have a drag element which is 2 cells long, it will not trigger the drop event, however if it is odd number, like 3, it WILL trigger it.如果我有一个长度为 2 个单元格的拖动元素,它不会触发放置事件,但是如果它是奇数,例如 3,它将触发它。 That is because he chooses the middle droppable element as target, but if it has 2 elements he has no middle element... Does anyone know a workaround, or some other events I can use?那是因为他选择中间的 droppable 元素作为目标,但如果它有 2 个元素,他就没有中间元素......有谁知道解决方法,或者我可以使用的其他一些事件? Here is an image of what I was trying to achieve:这是我试图实现的目标的图像:
code for draggable/droppable:可拖动/可放置的代码:
$(".draggable").draggable({
containment: '.calendar-cells',
grid: [47, 27]
});
$(".day").droppable({
drop: function (event, ui) {
console.log(event);
}
});
EDIT: Here is the fiddle: https://jsfiddle.net/k5ovt5gk/3/编辑:这是小提琴: https : //jsfiddle.net/k5ovt5gk/3/
最后用 css 解决了它......给每个奇数单元格增加了 .1px 的宽度,以便它可以找到一个中间元素......愚蠢的解决方案,但现在有效
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.