我有以下幾點:Jquery droppable與淘汰賽 - 如何從內部取消「下降」?
$(".subject-box").droppable({
// revert: "invalid",
activeClass: 'subject-box-active',
hoverClass: 'subject-box-hover',
accept: ".subject-box, .class-box",
tolerance: 'intersect',
drop: function (event, ui) {
dropItem(ko.dataFor(ui.draggable.context), ko.dataFor(this));
setTimeout(function() {
$('#container').isotope('remove', ui.draggable);
}, 0);
}
});
所以我接受了CSS類的.subject-box
或.class-box
什麼,然後調用dropItem
當物品被丟棄。掉物品開關DROPITEM是在這裏:
var dropItem = function(item, parent) {
// do some evaluation of the item (dragged) and parent (accepts item being dragged)
// possible cancel based on values of item or parent
return;
};
這使我獲得了item
和parent
對象,所以我可以進行一些評估,這是工作正常,但我需要取消拖放操作,如果父對象的某些屬性真 - 具體來說,認證相關的屬性。
我該如何取消drop:
中的放置動作,或給accept:
訪問父項和子項以在那裏執行評估?