jQuery sortable item height

落花浮王杯 提交于 2019-12-03 01:15:29

After much hair-tearing I added this event to the sortable:

  start: function( event, ui ) {
    $( this ).sortable( 'refreshPositions' )
  },

It seems to do the trick as I think start() is called after the helper has been created, so refreshing the positions resets the height. Probably jQuery should do this itself, but for now I'm happy.

The following worked for me:

stop: function(event,ui){
    ui.item.height("auto");
}

You could grab the current height of the Div being dragged, save it in a variable and assign a generic height to the DIV being dragged. Once it's placed, use the call back to reassign the height within the variable.

var curHeight = $(div).height();  

$(div).css({height: 20px;});

You may also want to consider forceHelperSize

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