【发布时间】:2016-07-12 07:00:27
【问题描述】:
我实现了可拖动和可选择的 jQuery UI。当我有两个已初始化的组件并选择其中一个时,如果我在没有释放鼠标的情况下单击另一个组件并开始拖动它,则从另一个组件中删除“ui-selected”类但它没有进入在任何可选择的情况下。
我需要一个方法或事件,在我上面描述的操作之后进入。
可选:
Selectable: {
init: function(el) {
$(el).selectable({
filter: '.existing-component',
selecting: function (event, ui) {
$(event.target).children('.ui-selecting').find('.existing-component').removeClass('ui-selecting');
},
stop: function(event, ui) {
console.log('stop');
});
start: function(event, ui) {
console.log('start');
});
});
// manually trigger the "select" of clicked elements
$(el).find('.existing-component').click( function(e){
.
.
.
$(el).selectable('refresh');
$(el).data("ui-selectable")._mouseStop();
});
}
}
可拖动:
Draggable: {
init: function(el, options) {
$(el).draggable(options, {
scroll: false,
snap: '.gridlines',
snapTolerance: $('.grid').attr('data-size') / 2,
// revert: "invalid",
preventCollision : true,
preventProtrusion : false,
collisionVisualDebug : false,
drag: function(event, ui) {
console.log('drag')
}
});
}
}
【问题讨论】:
-
我不认为它的重复对我来说是完美的,问题是我需要在上面描述的操作后取消选择组件时获得事件。
标签: jquery jquery-ui jquery-plugins jquery-ui-draggable jquery-ui-selectable