Change the size of dragged clone when hovering droppable?

自闭症网瘾萝莉.ら 提交于 2019-12-14 02:41:18

问题


$(".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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!