jquery禁用某些元素的删除

时间:2013-03-23 03:42:39

标签: jquery drag-and-drop

我试图在“.buildingWrapper”div上禁用drop元素,但是drop必须在“.starWrapper”div中!

$( ".menuBuilding" ).draggable({ 
    containment: ".gameWrapper",
    drag: function( event, ui ) {

    },
});


$(".buildingWrapper").droppable({
    drop: function( event, ui ) {
        var elm = ui.draggable;

        if ($(this).attr("class") == 'buildingWrapper') {
            ui.draggable = $("<div style='background: blue; height: 100px; width: 100px;'></div>");
        } else {
            ui.draggable = $(elm);
        }
    }
});

0 个答案:

没有答案