问题
$(".drag").draggable({
helper: 'clone',
appendTo: "body"
});
$( ".drop" ).droppable({
over: function(event, ui) {
$(ui.draggable).css({width:'30px',height:'30px'});
},
drop: function( event, ui ) {
if($(ui.draggable).parent() !==$(this)){
$(ui.draggable).appendTo($( this ));
$(ui.draggable).tooltip({ disabled: true });
$(ui.draggable).css({float:'left'});
}
}});
I am trying to change the size of the dragged clone item when i hover over the droppable area but leave the original the same size (so that the item attached to the mouse shrinks when im over the correct dropzone). This code changes the original but not the clone. Any suggestions?
回答1:
this did the job. Accessed the clone helper directly.
$( ui.helper).css({width:'30px',height:'30px'});
来源:https://stackoverflow.com/questions/15125708/change-the-size-of-dragged-clone-when-hovering-droppable