0

我正在尝试禁用在“.buildingWrapper”div 上放置元素,但放置必须在“.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);
        }
    }
});
4

0 回答 0