我做了一些JQuery UI可拖动的实验,但目前我的应用程序不工作,我不明白为什么。下面的代码:jQuery UI拖放不工作
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
<script type="text/javascript">
$(".productItem").draggable({
helper: 'clone',
handle: "productItem"
});
$("#basket").droppable({
accept: ".productItem",
drop: function(event, ui){
$("<div></div>")
.html(ui.draggable.text())
.appendTo($(this));
}
});
</script>
</head>
<body>
<h2>Products</h2>
<div id="list">
<div class="productItem">product 1</div>
<div class="productItem">product 2</div>
<div class="productItem">product 3</div>
</div>
<hr/>
<h2>Basket</h2>
<div id="basket" style = "height: 100px; border: 1px solid red;">
</div>
</body>
</html>
这个代码在的jsfiddle回环,但我似乎无法使它在铬工作,所以我认为这是因为jQuery的包括。有人能帮助我吗?
将jQuery UI的版本更改为1.8.23并重新测试。 –
它不适用于1.8.23 ... –
然后它是jQuery版本。无论如何,你更喜欢使用jQuery UI 1.8.23,它非常稳定。在jQuery 1.7.2中使用它。 –