我在Jqueryui Droppable.Sorry上有一个问题,我的英语很差。问题是,现在div c可以接受div a和div b作为副本,div b可以接受Shear.How,我希望div c可以接受div a和div b作为副本,div b作为Shear.How,我能得到这个吗?
发布于 2012-02-22 14:10:58
Its (英语)是一个常见的问题;)
您可以为可拖动对象设置类,然后在拖放事件时匹配上下文。
$(function() {
$( "#diva" ).draggable(
drag: function(event, $ui) {
$ui.addClass('copy');
},
stop: function(event, $ui) {
$ui.removeClass('copy');
}
);
$( "#divb" ).draggable(
drag: function(event, $ui) {
$ui.addClass('shear');
},
stop: function(event, $ui) {
$ui.removeClass('shear');
}
);
$( "#divc" ).droppable({
drop: function( event, $ui ) {
// you can access the dragglable html by this
// and then can append it to anywhere, its like making its copy
var html = $ui.draggable.html();
if ($ui.draggable.hasClass('shear')) {
// destroy #divb here so that it looks like shear
}
}
});
});https://stackoverflow.com/questions/9389766
复制相似问题