Skip to content

Commit 703c52d

Browse files
authored
Merge pull request #506 from troolee/fix/460
fix #460: fix cellWidth method
2 parents b09ae61 + d47ad9c commit 703c52d

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

dist/gridstack.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@
10431043
var o = $(this);
10441044
self.grid.cleanNodes();
10451045
self.grid.beginUpdate(node);
1046-
cellWidth = Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
1046+
cellWidth = self.cellWidth();
10471047
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
10481048
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
10491049
self.placeholder
@@ -1494,8 +1494,7 @@
14941494
};
14951495

14961496
GridStack.prototype.cellWidth = function() {
1497-
var o = this.container.children('.' + this.opts.itemClass).first();
1498-
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
1497+
return Math.round(this.container.outerWidth() / this.opts.width);
14991498
};
15001499

15011500
GridStack.prototype.getCellFromPixel = function(position, useOffset) {

0 commit comments

Comments
 (0)