我必须对象/元素。一个是[带有不同ID的4个图像]和[带有id容器的div] ....
我想让图片可以拖动并提醒图像的id如果它在容器div中被正确拖放......
然后使用php和jquery $ .ajax
将其值发送到mysql答案 0 :(得分:1)
使用jQuery UI的Dropable
$( 'selector for DIV' ).droppable ( {
drop: function ( event, ui ) {
// ui.draggable is a jQuery object representing your image
}
} );
答案 1 :(得分:0)
$('#container').droppable({
accept: 'img'
drop: function(event, ui){
var id=$(ui.draggable).attr('id');
$.ajax({
url: 'myurl.php',
data: {id: id},
success: function(data){
//do something with data
}
})
}
});
$('img.draggable').draggable();//assuming all draggable images have a draggable class