我真的需要你的帮助。我一直在努力做到这一点,但我就是做不到..
jsfiddle:http: //jsfiddle.net/5Vyq8/13/
js代码:
$(document).ready(function () {
// Treetable
$("table").treetable({
expandable: true,
initialState: "expanded",
expanderTemplate: "<a href='#'> </a>",
indent: 24,
column: 0
});
// Draggable
$("table .draggable").draggable({
opacity: .75,
refreshPositions: true,
revert: "invalid",
revertDuration: 300,
scroll: true,
delay: 100,
cursor: 'move'
});
//Droppable
$("table tbody tr").each(function () {
$(this).droppable({
accept: ".draggable",
hoverClass: "append-to-task",
over: function (e, ui) {
// add class 'accept-incoming-task' to the row under after 1 second
},
out: function () {
},
drop: function (e, ui) {
var droppedEl = ui.draggable;
// Adds the task as the first child to dropped row
$("table").treetable("move", droppedEl.data("ttId"), $(this).data("ttId"));
},
});
});
});
我想要实现的是:
- 将一行拖到另一行(完成!)
- 悬停超过 1 秒时,它应该在下面的行中添加一个类
- 当仍然悬停并移动到其他行时,它应该删除上一步中添加的类
我感谢您的时间和帮助。