Skip to content

Commit 3ec0c6f

Browse files
author
David Morse
committed
Move the check for responsive width above the calculations of width. This will prevent the calculated values changing the width for browsers which don't respect min-width
1 parent aa8f4bf commit 3ec0c6f

File tree

5 files changed

+17
-20
lines changed

5 files changed

+17
-20
lines changed

dist/jquery.gridster.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,15 +3866,14 @@
38663866
cols = this.get_highest_occupied_cell().col;
38673867
}
38683868

3869-
if(this.is_responsive()) {
3870-
this.$el.css({'min-width': '100%', 'max-width': '100%'});
3871-
return this;
3872-
}
3873-
3874-
var max_cols = (this.options.autogrow_cols ? this.options.max_cols : this.cols);
3869+
var max_cols = (this.options.autogrow_cols ? this.options.max_cols : this.cols);
38753870

38763871
cols = Math.min(max_cols, Math.max(cols, this.options.min_cols));
38773872
this.container_width = ((cols + 1) * this.options.widget_margins[0]) + (cols * this.min_widget_width);
3873+
if(this.is_responsive()) {
3874+
this.$el.css({'min-width': '100%', 'max-width': '100%'});
3875+
return this; //if we are responsive exit before setting the width of $el
3876+
}
38783877
this.$el.css('width', this.container_width);
38793878

38803879
return this;

dist/jquery.gridster.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.gridster.with-extras.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,15 +3866,14 @@
38663866
cols = this.get_highest_occupied_cell().col;
38673867
}
38683868

3869-
if(this.is_responsive()) {
3870-
this.$el.css({'min-width': '100%', 'max-width': '100%'});
3871-
return this;
3872-
}
3873-
3874-
var max_cols = (this.options.autogrow_cols ? this.options.max_cols : this.cols);
3869+
var max_cols = (this.options.autogrow_cols ? this.options.max_cols : this.cols);
38753870

38763871
cols = Math.min(max_cols, Math.max(cols, this.options.min_cols));
38773872
this.container_width = ((cols + 1) * this.options.widget_margins[0]) + (cols * this.min_widget_width);
3873+
if(this.is_responsive()) {
3874+
this.$el.css({'min-width': '100%', 'max-width': '100%'});
3875+
return this; //if we are responsive exit before setting the width of $el
3876+
}
38783877
this.$el.css('width', this.container_width);
38793878

38803879
return this;

dist/jquery.gridster.with-extras.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery.gridster.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,15 +3019,14 @@
30193019
cols = this.get_highest_occupied_cell().col;
30203020
}
30213021

3022-
if(this.is_responsive()) {
3023-
this.$el.css({'min-width': '100%', 'max-width': '100%'});
3024-
return this;
3025-
}
3026-
3027-
var max_cols = (this.options.autogrow_cols ? this.options.max_cols : this.cols);
3022+
var max_cols = (this.options.autogrow_cols ? this.options.max_cols : this.cols);
30283023

30293024
cols = Math.min(max_cols, Math.max(cols, this.options.min_cols));
30303025
this.container_width = ((cols + 1) * this.options.widget_margins[0]) + (cols * this.min_widget_width);
3026+
if(this.is_responsive()) {
3027+
this.$el.css({'min-width': '100%', 'max-width': '100%'});
3028+
return this; //if we are responsive exit before setting the width of $el
3029+
}
30313030
this.$el.css('width', this.container_width);
30323031

30333032
return this;

0 commit comments

Comments
 (0)