[英]jquery-ui sortable placeholder wrong position
I need to sort bootstrap blocks and I have some problems with placeholder. 我需要对引导程序块进行排序,而占位符有一些问题。
$('.buildBlockContainer').sortable({
handle: '.sortableHandler',
connectWith: '.buildBlockContainer',
cancel: '',
placeholder: 'buildBlockPlaceholder',
start: function(e, ui) {
ui.placeholder.height(ui.item.height());
ui.placeholder.width(ui.item.width());
}
});
Full example here: https://jsfiddle.net/ShinShil/74grstLs/ 完整示例在这里: https : //jsfiddle.net/ShinShil/74grstLs/
Firstly placeholder must have the same float, position and display styles as item. 首先,占位符必须与项目具有相同的浮点,位置和显示样式。
Secondary the width of bootstrap cols have paddings and they not in width, but in offsetWidth: ui.placeholder.width(ui.item[0].offsetWidth)
次要的,bootstrap cols的宽度具有填充,它们的宽度不是宽度,而是offsetWidth:
ui.placeholder.width(ui.item[0].offsetWidth)
complete example https://jsfiddle.net/ShinShil/0d22bo83/5/ 完整示例https://jsfiddle.net/ShinShil/0d22bo83/5/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.