從閱讀幾個簡單的問題看來,好像我的問題可能是DOM元素不能有多個JQuery UI Droppable 範圍。我想知道是否有人可以證實這一點,或者可能提出一種解決方法?Jquery UI可拖拽和放置 - 示波器
比如我有我想要的清單上放置兩個拖拽元素:
<ol>
<li>one
</li>
<li>two
</li>
<li>three
</li>
<li>four
</li>
</ol>
<div id="drag">drag me1
</div>
<div id="drag2">drag me2
</div>
有基於哪些因素拖到列表分配兩個不同結果的方式(這是微不足道的這個例子,但在現實生活中,我有一套更復雜的列表和元素)?
在這個例子中,我有:
$('#drag').draggable({scope: "one"});
$('#drag2').draggable({scope: "two"});
$('ol li').droppable({scope: "one", drop: function(){ alert("one");}})
$('ol li').droppable({scope: "two", drop: function(){ alert("two");}})
但只drag1
可以移動到列表,造成秒警報被解僱。
看起來好像使用範圍只是導致拖放之間的衝突,並且不能像我期望的那樣工作......並且如果它不像這樣工作,那麼scope
參數的目的是什麼?
這裏是我的例子的小提琴與玩;任何幫助非常讚賞: Fiddle here
相關:http://stackoverflow.com/questions/11066497/jquery-ui -drag-droppable-with-multiple-scopes – alxndr