我试图使用Jquery Draggable,但我注意到一个闪烁时,目标项目被解除,然后下降,徘徊在其旧位置,或带出其容器。在拖动的div图像只是消失或出现在错误的位置(它应该总是显示在相同的位置,而拖动-正如你所期望的)。
你知道怎么纠正吗?
我的代码: http://jsfiddle.net/PTSkR/28/$(function () {
$('#container').isotope({
// options
itemSelector: '.study-box',
layoutMode: 'fitRows'
});
});
$(function () {
$(".study-box").draggable({
revert: "invalid",
helper: function () {
// We removeAttr('style') to get rid of the transform css that isotope added.
return $(this).clone().removeAttr('style').removeClass('isotope-item').addClass('drag-helper').appendTo('body');
},
start: function () {
$(this).hide();
},
stop: function () {
$(this).show();
},
zIndex: 100
});
});
$(function () {
$(".folder-box").draggable({ revert: "invalid" });
$(".folder-box").droppable({
// revert: "invalid",
accept: ".folder-box, .set-box",
drop: function (event, ui) {
var $this = $(this);
//ui.draggable.clone().removeAttr('style').removeClass('.folder-box').appendTo($this);
$('#container').isotope('remove', ui.draggable);
}
});
});
JavaScript没有问题,只是从CSS中删除了所有的"position:fixed"。