0
HTML文件:jQuery的:可放開不起作用
<!DOCTYPE html> <html>
<head>
<meta charset="utf-8" />
<title>Drag and drop</title>
<link rel="stylesheet" href="style.css">
<script src="jquery-3.1.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="script.js"></script>
</head>
<body>
<ul>
<li> Milk </li>
<li> Bread </li>
</ul>
<div id ="list"></div>
</body> </html>
CSS文件,工作非常好: 「看起來你的帖子大多代碼,請添加一些更多的細節」
ul { padding: 0; list-style: none; color: red } #list {
width: 450px;
height: 450px;
background-color: #f0f0f0;
border: 1px solid #000;
overflow: auto; } #list.border {
border-width: 2px; }
jQuery的文件:
$(document).ready(function() { $('li').draggable({containment: 'document', revert: true, start: function()
{
contents = $(this).text();
}
}); $('#list').droppable({hoverClass: 'border', drop: function()
{
$('#list').append(contents + '<br />');
}
}); });
功能「可棄」不行,我不能發現的bug。