<script language="javascript" src="jquery.ui/jquery-1.2.4a.js"></script>
<script language="javascript" src="jquery.ui/ui.base.min.js"></script>
<script language="javascript" src="jquery.ui/ui.draggable.min.js"></script>
<script language="javascript" src="jquery.ui/ui.droppable.min.js"></script>
$(function(){
$(".
draggable").
draggable({
helper:"clone"});//采用clone方式复制拖拽
$("#droppable-accept").droppable({
accept: function(draggable){
//接收类别为green的
return $(draggable).hasClass("green");
},
drop: function(){
$(
this).append($("<div></div>").html("drop!"));
}
});
});
<body>
<div class="draggable red">draggable red</div>
<div class="draggable green">draggable green</div>
<div id="droppable-accept" class="droppable">droppable<br></div>
</body>