Jquery拖放:拖放背景图像

Jquery Drag and Drop: Drop on the background image

本文关键字:拖放 图像 背景 Jquery      更新时间:2023-09-26

我想拖动面板菜单项,但这里的项是拖动。如何放下上面的背景图片....

   $(".drag-images").draggable({
         revert: 'invalid',
         containment: "#panel-03, #drop",
         stop: function() { $(this).draggable('option','revert','invalid');}
    });
    $("#panel-03 img" ).draggable({ stack: "#panel-03 img" });
    $("#drop").droppable({
         greddy: true,
         tolerance: 'touch',
         drop: function(event,ui){
                ui.draggable.draggable('option','revert','true');
         }
    });

小提琴

您缺少一些脚本。

请将此脚本添加到您的html并尝试

<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>

也从你的css

#panel-03{
    //  remove all overflows hidden
}

删除溢出,图像不显示的问题也将得到修复。