jQueryUI droppable, stop propagation to overlapped sibling

前端 未结 9 911
忘了有多久
忘了有多久 2020-12-02 01:59

As you can see here: http://jsfiddle.net/rA4CB/6/

When I make the drop in the overlapped area it is received in both droppables, greedy doesn\'t work when the items

9条回答
  •  春和景丽
    2020-12-02 02:12

    It's very similar to invertedSpear answer. I had to change it a little bit because enabling/disabling inside "over"/"out" didn't work for me .I had to do below instead

    $("#droppable2").droppable({
        greedy: true,
        drop: function (event, ui) {
            $("droppable").droppable("disable");
        }
    }
    

    I had to explicitly enable"droppable" div when I needed it. For instance, enable it when starting the drag event. Eg

    $("#drageMe").draggable({
     start:function(event,ui){
       $("droppable").droppable("enable");  
    

    } })

提交回复
热议问题