Jクエリコード
function itemInSpot(drag_item,spot)
{
var oldSpotItem = $(spot).find('img');
if(oldSpotItem.length>100) {
oldSpotItem.appendTo('#itembox4').draggable({ revert: 'invalid' });
}
var item = $('<img />');
item.attr('src',drag_item.attr('src')).attr('class',drag_item.attr('class')).appendTo(spot).draggable({ revert: 'invalid' });
drag_item.remove(); // remove the old object
}
$(document).ready(function() {
$("img").draggable({ revert: 'invalid'});
$("img").addClass(classname,function(index,currentclass))
$("#itembox4").droppable()
$("#pricebox").droppable({ accept: '#price'});
$('#pricebox').droppable({ accept: '#price'});
$('#pricebox,#pricebox,#itembox4').bind('drop', function(ev,ui) { itemInSpot(ui.draggable,this); });
$('#itembox4 img').hide();
$('#clone_button').click(function() {
$('#clone_wrapper div:#pricebox')
.clone()
.append('')
.appendTo($('#clone_wrapper'));
})
});
$(function() {
$('#filter').change(function(){
$('#itembox4 img').hide();
$('.'+$(this).val()).show();});
});
追加しましたが、画像を移動するとID$("img").addClass(classname,function(index,currentclass))
が失われ、ボックスにドラッグして戻すと、再度ドラッグできなくなります。
私は何を達成しようとしていますか?ID
を失わないか、ドラッグ アンド ドロップ後に配置されると自動的に再追加される可動画像。
画像はすべて死んでいますが、それらはすべてまだjqueryで動作します.
私が試し
たこと アイテムをclass="price"
代わりに元に戻すid="price"