好的,我试图简化这个,但仍然有问题。 我试图进行拖放测验,其中有两个答案选项,'水果'或者' veg'。我会尝试在每个项目放在正确的位置时制作每个项目(div),我希望它能够逐渐消失,并且做得好“#39;消息出现在最后。
$( function() {
$( "#draggable" ).draggable({ revert: "valid" });
$( "#draggable2" ).draggable({ revert: "invalid" });
$( "#droppable" ).droppable({
classes: {
"ui-droppable-active": "ui-state-active",
"ui-droppable-hover": "ui-state-hover"
},
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
.find( "p" )
.html( "Dropped!" );
}
});
} );
https://jsfiddle.net/lampboy2000/dtvt1sj8/