0
我有一個可拖動的項目一類的「.item」,一旦我將其拖動到目的地它只是坐在那裏,我不能移動它,這是我使用的代碼:jQuery可拖動助手不可拖動?
$('.item').draggable({
helper : 'clone',
onStartDrag:function(){
$(this).draggable('options').cursor = 'not-allowed';
$(this).draggable('clone').css('z-index',10);
},
onStopDrag:function(){
$(this).draggable('options').cursor='move';
}
});
$('.cart').droppable({
drop: function(event, ui) {
$.ui.ddmanager.current.cancelHelperRemoval = true;
},
onDragEnter:function(e,source){
$(source).draggable('options').cursor='auto';
},
onDragLeave:function(e,source){
$(source).draggable('options').cursor='not-allowed';
$.ui.ddmanager.current.cancelHelperRemoval = false;
},
onDrop:function(e,source){
var name = $(source).find('p:eq(0)').html();
var price = $(source).find('p:eq(1)').html();
addProduct(name, parseFloat(price.split('$')[1]));
}
});
但助手的目的修訂下落功能,使項目的副本,而不是拖到原來的項目。 –
好吧,我undrestand你,我已經修改了代碼 –
謝謝你的幫助@Yasemin,但現在該項目甚至沒有落在購物車類,我可以拖動它,但是當我放棄它時,它就會消失。 –