Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08f0015

Browse files
committed
min size for 1x1 cell
1 parent a4d97a1 commit 08f0015

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/gridstack.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
content: "\f065";
6969
}
7070

71+
.grid-stack-item { min-width: 8.33333333% }
72+
7173
.grid-stack-item[data-gs-width="12"] { width: 100% }
7274
.grid-stack-item[data-gs-width="11"] { width: 91.66666667% }
7375
.grid-stack-item[data-gs-width="10"] { width: 83.33333333% }

src/gridstack.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@
434434
};
435435

436436
GridStack.prototype._update_styles = function (max_height) {
437+
var prefix = '.' + this.opts._class + ' .' + this.opts.item_class;
438+
437439
if (typeof max_height == 'undefined') {
438440
max_height = this._styles._max;
439441
this._styles._max = 0;
@@ -448,9 +450,12 @@
448450
this._update_container_height();
449451
}
450452

453+
if (this._styles._max == 0) {
454+
Utils.insert_css_rule(this._styles, prefix, 'min-height: ' + (this.opts.cell_height) + 'px;', 0);
455+
}
456+
451457
if (max_height > this._styles._max) {
452458
for (var i = this._styles._max; i < max_height; ++i) {
453-
var prefix = '.' + this.opts._class + ' .' + this.opts.item_class;
454459
Utils.insert_css_rule(this._styles,
455460
prefix + '[data-gs-height="' + (i + 1) + '"]',
456461
'height: ' + (this.opts.cell_height * (i + 1) + this.opts.vertical_margin * i) + 'px;',

0 commit comments

Comments
 (0)