Skip to content

Commit 3440710

Browse files
committed
Merge branch 'develop'
2 parents b0c24c0 + f39cf22 commit 3440710

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/gridstack.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@
106106
height = parseFloat(match[1]);
107107
}
108108
return {height: height, unit: heightUnit};
109+
},
110+
111+
removePositioningStyles: function(el) {
112+
var style = el[0].style;
113+
if (style.position) style.removeProperty('position');
114+
if (style.left) style.removeProperty('left');
115+
if (style.top) style.removeProperty('top');
109116
}
110117
};
111118

@@ -869,13 +876,14 @@
869876
$(ui.helper).remove();
870877
node.el = el;
871878
self.placeholder.hide();
879+
Utils.removePositioningStyles(el);
880+
872881
el
873882
.attr('data-gs-x', node.x)
874883
.attr('data-gs-y', node.y)
875884
.attr('data-gs-width', node.width)
876885
.attr('data-gs-height', node.height)
877886
.addClass(self.opts.itemClass)
878-
.removeAttr('style')
879887
.enableSelection()
880888
.removeData('draggable')
881889
.removeClass('ui-draggable ui-draggable-dragging ui-draggable-disabled')
@@ -1170,19 +1178,19 @@
11701178
} else {
11711179
self._clearRemovingTimeout(el);
11721180
if (!node._temporaryRemoved) {
1181+
Utils.removePositioningStyles(o);
11731182
o
11741183
.attr('data-gs-x', node.x)
11751184
.attr('data-gs-y', node.y)
11761185
.attr('data-gs-width', node.width)
1177-
.attr('data-gs-height', node.height)
1178-
.removeAttr('style');
1186+
.attr('data-gs-height', node.height);
11791187
} else {
1188+
Utils.removePositioningStyles(o);
11801189
o
11811190
.attr('data-gs-x', node._beforeDragX)
11821191
.attr('data-gs-y', node._beforeDragY)
11831192
.attr('data-gs-width', node.width)
1184-
.attr('data-gs-height', node.height)
1185-
.removeAttr('style');
1193+
.attr('data-gs-height', node.height);
11861194
node.x = node._beforeDragX;
11871195
node.y = node._beforeDragY;
11881196
self.grid.addNode(node);

0 commit comments

Comments
 (0)