2016-10-01 45 views
1

我已经找到不错的剧本:http://jsfiddle.net/wfG3L/554/,它是关于将&下降。拖放转变作风下降后,进入特定的div

我想改变宽度或类.card的高度,如果我把它扔到.stackDrop1或.stackDrop2和滴速到#launchPad回来后给它。

任何人都可以帮助我吗?我真的很感激。

$("#launchPad").height($(window).height() - 20); 
var dropSpace = $(window).width() - $("#launchPad").width(); 
$("#dropZone").width(dropSpace - 10); 
$("#dropZone").height($("#launchPad").height()); 

$(".card").draggable({ 
    appendTo: "body", 
    cursor: "move", 
    helper: 'clone', 
    revert: "invalid", 
}); 

$("#launchPad").droppable({ 
    tolerance: "intersect", 
    accept: ".card", 
    activeClass: "ui-state-default", 
    hoverClass: "ui-state-hover", 
    drop: function(event, ui) { 
     $("#launchPad").append($(ui.draggable)); 
    } 
}); 

$(".stackDrop1").droppable({ 
    tolerance: "intersect", 
    accept: ".card", 
    activeClass: "ui-state-default", 
    hoverClass: "ui-state-hover", 
    drop: function(event, ui) {   
     $(this).append($(ui.draggable)); 

    } 
}); 

$(".stackDrop2").droppable({ 
    tolerance: "intersect", 
    accept: ".card", 
    activeClass: "ui-state-default", 
    hoverClass: "ui-state-hover", 
    drop: function(event, ui) {   
     $(this).append($(ui.draggable)); 
    } 
}); 

回答

1

试试这个CSS:

.stack .card.ui-draggable 
{ 
    background-color:orange; 
} 
+0

太感谢你了!我挣扎了两个小时:D .. –