我有一个可拖动的对象,它被放置在重叠的可放置对象的等距网格上。droppables 是灰色瓷砖、img 标签,看起来像附加的第一张图片。当可拖动对象在它们上方时,它们被设置为突出显示蓝色。
这是droppable的源代码:
$(".sprite").droppable({
drop: function(event,ui) {
object_id = ui.draggable.attr("id").replace("sprite_","");
set_action('move_object',$(this).attr("id"));
set_target(object_id);
ui.draggable.removeClass("holding");
},
over: function(event, ui) {
$(this).attr("src",$(this).attr("src").replace('.png','-hover-blue.png'));
},
out: function(event, ui) {
$(this).attr("src",$(this).attr("src").replace('-hover-blue.png','.png'));
},
tolerance: 'pointer'
});
基本上,我希望 a) 一次突出显示一个图块,并且 b) 将突出显示的图块放置在对象上。
我已经尝试了所有类型的宽容,但无济于事。
图片:
i.imgur.com/dGx9X.png
和
i.imgur.com/vb1d9.png