【发布时间】:2018-07-10 10:44:48
【问题描述】:
我正在制作一个带有 tabpane 的 web 应用程序。要将选项卡移动到选项卡窗格中并进入其他窗口,我正在使用本机 HTML 拖放。
要在选项卡窗格中移动选项卡,用户可以将一个选项卡拖到另一个选项卡上,然后根据在选项卡上拖动的位置将其放置在左侧或右侧。我不确定如何找到标签放在另一个标签上的位置。
$(document).on('dragstart', '.tabpane li', function(e) {
...
});
$(document).on('dragover', '.tabpane li', function(e) {
e.preventDefault();
});
$(document).on('drop', '.tabpane li', function(e) {
var droppedOnTabAt = ? ? ? ; // How do I find this?
if (droppedOnTabAt.x > $(this).width() / 2) {
// move tab to the right of the dropped onto tab
} else {
// move tab to the left of the dropped onto tab
}
});
【问题讨论】:
-
检查事件对象
标签: javascript jquery html