我在jquery 1.3.1(UI版本1.5.3)中的可拖放效果有問題。據我所知,除drop()函數未被調用外,一切都可以正常工作。我可以告訴可拖拽的目標是接受被拖拽的元素(通過縮略圖類),但可拖拽的項目不會掉落。感謝您的幫助!jquery拖放問題:drop()函數永遠不會被調用
<html>
<head>
<script type="text/javascript" language="javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript" language="javascript" src="/jquery/jquery.ui.js"></script>
<script type="text/javascript" language="javascript">
//<!--
$(document).ready(function() {
$('.drop_box').droppable({
accept: '.thumbnail',
activeClass: 'droppable-active',
hoverClass: 'droppable-hover',
drop: function (ev, ui) {
alert("Dropped!");
}
});
$('#sample_thumbnail').draggable({
helper: 'clone'
});
});
//-->
</script>
<style type="text/css">
.drop_box {
top:16px;
width:250px;
height:250px;
border:1px solid #000000;
float: right;
}
.droppable-hover {
background-color: #eeeeee;
border: 1px solid red;
}
.droppable-active {
background-color: orange;
color: white;
border: 1px solid blue;
}
.thumbnail {
width:100px;
height:100px;
border:1px solid green;
}
</style>
</head>
<body>
<div class="drop_box">droppable</div>
<div id="sample_thumbnail" class="thumbnail">draggable</div>
</body>
</html>
謝謝!我安裝了UI 1.6rc6,它像一個魅力。 – matt 2009-02-09 05:33:28