Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive layouts overlap #600

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a391304
fix(gridster): changed the way widgets were getting positioned so tha…
Feb 18, 2015
754b313
Release v0.6.0
Feb 18, 2015
afd83fe
fix(gridster): fixing drag limit issues when using autogrow_cols
Feb 21, 2015
dbc226d
fix(gridster): fixed expand_widget bug not expanding full width of wi…
Feb 21, 2015
9ead8c0
Release v0.6.1
Feb 21, 2015
749f37a
fix(gridster): forcing height of gridster container to auto when in c…
Feb 24, 2015
d669045
Release v0.6.2
Feb 24, 2015
61572cd
fix(gridster): fixes bug where widgets would overlay other widgets af…
Feb 24, 2015
04e2cf7
Merge pull request #2 from DecksterTeam/resize-overlap
fhawkes Feb 24, 2015
fa29663
fix(gridster): adding bower.json file
Feb 25, 2015
5f86f98
Merge branch 'master' of github.com:DecksterTeam/gridster.js
Feb 25, 2015
7654437
fix(gridster): adding bower.json file
Feb 25, 2015
14e08d9
refactor(gridster): adding callback to add_widget function
Mar 4, 2015
6bb47dc
fix(gridster): fixing resize limits when in fixed width mode
Mar 6, 2015
fc75ce5
Release v0.6.3
Mar 6, 2015
8a5a723
#3 Adds ability to automatically center widgets in the grid.
Mar 19, 2015
e40a393
Release v0.6.4
Mar 19, 2015
16a7a65
#3 Adds ability to automatically center widgets in the grid.
Mar 19, 2015
86053f8
fix(gridster): fixed bugs in centering_widgets (widgets were getting …
Apr 6, 2015
bbd9cd4
Release v0.6.5
Apr 6, 2015
f8d3d2d
Release v0.6.5
Apr 6, 2015
d5bf56c
chore(grunt): fixing versioning system
Apr 6, 2015
9d077da
fix(gridster): preventing gridster from adding extra resize handles
Apr 14, 2015
12f4ab1
Revert "fix(gridster): preventing gridster from adding extra resize h…
Apr 14, 2015
6c5ef28
preventing gridster from creating extra resize handles while centering
Apr 14, 2015
0286676
Merge pull request #6 from DecksterTeam/dadams
fhawkes Apr 14, 2015
65f43a5
Release v0.6.6
Apr 14, 2015
e69c3e8
fix(gridster): responsive width now resizes based off wrapper not window
fhawkes Apr 22, 2015
b732205
Release v0.6.7
fhawkes Apr 22, 2015
dab6839
Fixed issue with css transitions
fhawkes May 5, 2015
d4b33d6
Release v0.6.8
fhawkes May 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(gridster): fixing drag limit issues when using autogrow_cols
floyd_hawkes committed Feb 21, 2015

Verified

This commit was signed with the committer’s verified signature.
macalinao Ian Macalinao
commit afd83fead8c719615ae01ef7b5d3863701ff2243
31 changes: 22 additions & 9 deletions src/jquery.gridster.js
Original file line number Diff line number Diff line change
@@ -369,7 +369,7 @@
this.set_dom_grid_width();
this.set_dom_grid_height();

this.drag_api.set_limits(this.cols * this.min_widget_width);
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols + 1) * this.options.widget_margins[0]));

return $w.fadeIn();
};
@@ -1233,7 +1233,7 @@
if (prcol >= this.cols - 1 && this.options.max_cols >= this.cols + 1) {
this.add_faux_cols(1);
this.set_dom_grid_width(this.cols + 1);
this.drag_api.set_limits(this.container_width);
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols + 1) * this.options.widget_margins[0]));
}

this.collision_api.set_colliders(this.faux_grid);
@@ -1324,7 +1324,7 @@
this.set_dom_grid_width();

if (this.options.autogrow_cols) {
this.drag_api.set_limits(this.cols * this.min_widget_width);
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols + 1) * this.options.widget_margins[0]));
}
};

@@ -2914,21 +2914,33 @@
};

/**
*
* Generates the width of the grid columns based on the width of the window.
* @returns {number}
*/
fn.get_responsive_col_width = function() {
var cols = this.cols || this.options.max_cols;
return (this.$el.width() - ((cols + 1) * this.options.widget_margins[0])) / cols;
};

/**
* Changes the minimum width of a widget based on the width of the window and the number of cols that can
* fit in it.
* @returns {Gridster}
*/
fn.resize_responsive_layout = function() {
this.min_widget_width = this.get_responsive_col_width();
this.generate_grid_and_stylesheet();
this.update_widgets_dimensions();
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols) * this.options.widget_margins[0]));
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols + 1) * this.options.widget_margins[0]));
return this;
};

/**
* Switches between collapsed widgets the span the full width when the responsive_breakpoint is triggered.
* @param collapse
* @param opts
* @returns {Gridster}
*/
fn.toggle_collapsed_grid = function(collapse, opts) {
if(collapse) {
this.$widgets.css({
@@ -2939,7 +2951,7 @@

this.$el.addClass('collapsed');

if(this.options.resize.enabled && this.resize_api) {
if(this.resize_api) {
this.disable_resize();
}

@@ -2953,18 +2965,19 @@
'min-height': 'auto'
});
this.$el.removeClass('collapsed');
if(this.options.resize.enabled && this.resize_api) {
if(this.resize_api) {
this.enable_resize();
}

if(this.drag_api) {
this.enable();
}
}
}
return this;
};

/**
* It generates the neccessary styles to position the widgets.
* It generates the necessary styles to position the widgets.
*
* @method generate_stylesheet
* @param {Number} rows Number of columns.