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/
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)
complete example https://jsfiddle.net/ShinShil/0d22bo83/5/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.