jQuery draggable + droppable: how to snap dropped element to dropped-on element

前端 未结 7 1288
无人及你
无人及你 2020-11-30 19:42

I have my screen divided into two DIVs. In the left DIV I have a few 50x50 pixel DIVs, in the right DIV I have an empty g

7条回答
  •  甜味超标
    2020-11-30 20:31

    $("form li").draggable({snap:'.ui-droppable', snapMode:'inner', revert:true});
    $('.drop').droppable({drop:function(ev, ui)
                               {$(ui.draggable).appendTo($(this))
                                               .css({position:'static', left:'0px', top:'0px'})
                                               .draggable('option', 'disabled', false)
                                               .css({position:'relative'});
                               }
                         }
                        );
    

提交回复
热议问题