0
jQuery UIをドラッグ可能かつ選択可能に実装しました。私はそれを初期化した2つのコンポーネントがあり、そのうちの1つを選択すると、マウスを離さずに他のコンポーネントをクリックしてドラッグすると、「ui-selected」クラスが他のコンポーネントから削除されますが、選択可能な任意のイベント。私は上記のアクションの後に入る方法やイベントが必要です、誰かが助けることができますか?jQuery UIの選択可能イベントはdraggaableでトリガーされません
アップデート1 選択:ドラッグ可能
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')
}
});
}
}
[mcve]を共有してください –
[jQuery UIの組み合わせ可能:ドラッグ可能と組み合わせる](http://stackoverflow.com/questions/5430815/jquery-ui-combining-selectable-with-draggable) –
I don'それは私が上で説明したアクションの後にコンポーネントが選択されていないときに問題を解決する必要があるだけです。 – FAndrew