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);
});
}
}
});
});
評論,如果您需要查看更多代碼