嗨,我想,一个事件开始了吗?可以放置元素snapps吗?
有没有可能意识到这一点?
Js此刻看起来像这样:
function MatchingTask(questions, answers) {
// Elemente Drag n Drop faehig machen
$(".match_task_draggable").draggable({
cursor: 'move',
containment: $('.match_task_draggable').parent('div').parent('div'),
scroll: false,
snap: ".match_task_drop",
snapMode: "inner",
stop: setDroppableAnswer
});
}
// Set Answer
function setDroppableAnswer(){
alert("Ba");
}
但是每次我放下一个元素时停止会做出反应,它只会在它被放到捕捉区域时作出反应
解决方案:
$(".match_task_drop").droppable({
drop: function( event, ui ) {
setDroppableAnswer( ui.draggable );
}
});