Skip to content

Commit dbc226d

Browse files
author
floyd_hawkes
committed
fix(gridster): fixed expand_widget bug not expanding full width of window
fix(gridster): user can specify size_x when expanding widget
1 parent afd83fe commit dbc226d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/jquery.gridster.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,15 @@
499499
* @method expand_widget
500500
* @param {HTMLElement} $widget The jQuery wrapped HTMLElement
501501
* representing the widget.
502+
* @param {Number} size_x The number of cols that will occupy the widget.
502503
* @param {Number} size_y The number of rows that will occupy the widget.
503504
* @param {Function} [callback] Function executed when the widget is removed.
504505
* @return {HTMLElement} Returns $widget.
505506
*/
506-
fn.expand_widget = function($widget, size_y, callback) {
507+
fn.expand_widget = function($widget, size_x, size_y, callback) {
507508
var wgd = $widget.coords().grid;
508-
var max_size_x = Math.floor(($(window).width() - this.options.widget_margins[0] * 2) /
509-
(this.min_widget_width + this.options.widget_margins[0] * 2));
510-
var size_x = Math.min(max_size_x, this.cols);
509+
var max_size_x = Math.floor(($(window).width() - this.options.widget_margins[0] * 2) / this.min_widget_width);
510+
size_x = size_x || Math.min(max_size_x, this.cols);
511511
size_y || (size_y = wgd.size_y);
512512

513513
var old_size_y = wgd.size_y;

0 commit comments

Comments
 (0)