Skip to content

Commit 75fb50e

Browse files
committed
Restore the value of gutterX when the screen is normal
1 parent 9cf1c55 commit 75fb50e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/minimasonry.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var MiniMasonry = function(conf) {
55
this._count = null;
66
this._width = 0;
77
this._removeListener = null;
8+
this._savedGutterX = null;
89

910
this._resizeTimeout = null,
1011

@@ -33,7 +34,7 @@ MiniMasonry.prototype.init = function(conf) {
3334
}
3435
}
3536
if (this.conf.gutterX == null || this.conf.gutterY == null) {
36-
this.conf.gutterX = this.conf.gutterY = this.conf.gutter;
37+
this._savedGutterX = this.conf.gutterX = this.conf.gutterY = this.conf.gutter;
3738
}
3839

3940
this._container = typeof this.conf.container == 'object' && this.conf.container.nodeName ?
@@ -69,11 +70,11 @@ MiniMasonry.prototype.reset = function() {
6970
this.conf.gutterX = this.conf.ultimateGutter;
7071
// As gutters are reduced, two column may fit, forcing to 1
7172
this._count = 1;
72-
}
73-
74-
if (this._width < (this.conf.baseWidth + (2 * this.conf.gutterX))) {
73+
} else if (this._width < (this.conf.baseWidth + (2 * this.conf.gutterX))) {
7574
// Remove gutter when screen is to low
7675
this.conf.gutterX = 0;
76+
} else {
77+
this.conf.gutterX = this._savedGutterX
7778
}
7879
};
7980

0 commit comments

Comments
 (0)