From reading a couple of simple questions it seems as though my problem may be that a DOM element cannot have more than one JQuery UI Droppable scope. I was wondering if someone could confirm this or maybe suggest a workaround?
For example I have a two draggables that I want to drop on a list:
<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>
Is there a way of assigning two different results based on which element is dragged onto the list (this is trivial in this example, but in real-life I have a more complex set of lists and elements)?
In this example I have:
$('#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");}})
But only drag1
can be moved onto the list, causing the second alert to be fired.
It seems as though using scope just causes a conflict between drag and drop and doesn't work as I'd expect... and if it doesn't work like this then what is the purpose of the scope
parameter?
Here is a fiddle of my example to play with; any help much appreciated: Fiddle here