1
我有一个页面充满了图像,专辑图稿是精确的。我添加了可拖动的代码,它只允许我拖动页面上的第一张图片。jQuery Draggable只允许1图像可拖动
这是为什么?
$(document).ready(function() {
$("#draggable").each(function() {
$(this).draggable({
revert: function (dropped) {
var dropped = dropped && dropped[0].id == "droppable";
if (!dropped);
return !dropped;
}
});
});
$("#droppable").droppable({
drop: function (event, ui) {
var AlbumToAdd = ui.draggable.data("id");
if (AlbumToAdd != '') {
// Perform the ajax post
$.post("/ShoppingCart/DragToCart", { "id": AlbumToAdd },
function (data) {
// Successful requests get here
// Update the page elements
$('#cart-total').text(data.CartTotal);
});
}
}
});
});
评论,如果您需要查看更多代码