想要将元素拖动到特定的 div,如果不拖动到该 div,将使用 jQuery UI 恢复(还原)
问问题
3160 次
1 回答
5
<div id="draggable" style="width: 50px; height: 50px; border: solid 1px #000;">Drag me!</div>
<div id="droppable" style="width: 150px; height: 150px; border: solid 1px #000;">Drop here!</div>
<script type="text/javascript">
$( "#draggable" ).draggable({ revert: true });
$( "#droppable" ).droppable({
accept: "#draggable",
drop: function( event, ui ) {
// the draggable is dropped
}
});
</script>
于 2010-12-13T17:15:13.803 回答