0
我已啓用在我的網頁上拖放表格行(代碼如下)。不幸的是,當我使用{ revert: invalid }
該行返回到它的原始位置,但有一個輕微的偏移量。它看起來大約在5px左右。當我克隆整個表格行時,這看起來很奇怪。任何人都可以提供任何理由爲什麼?jQuery UI Draggable:不會恢復到原始位置
function setupDragDrop(source, target) {
source.draggable({
revert: 'invalid',
opacity: 0.9,
cursor: 'move',
helper: function(event) {
var target = $(event.target).closest('tr');
var target_children = target.children();
var clone = target.clone();
clone.children().width(function(i,val) {
return target_children.eq(i).width();
});
return $('<div class="configbox drag-row"><table class="lanes"></table></div>')
.find('table').append(clone).end();
},
start : function() {
//this.style.display="none";
},
stop: function() {
//this.style.display="";
},
appendTo: 'body'
});
target.droppable({
drop: function(event, ui) {
$(this).parent().append(ui.draggable);
},
accept: source.selector
});
}