diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 62bce8783..06b2b2153 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -499,15 +499,15 @@ * @method expand_widget * @param {HTMLElement} $widget The jQuery wrapped HTMLElement * representing the widget. + * @param {Number} size_x The number of cols that will occupy the widget. * @param {Number} size_y The number of rows that will occupy the widget. * @param {Function} [callback] Function executed when the widget is removed. * @return {HTMLElement} Returns $widget. */ - fn.expand_widget = function($widget, size_y, callback) { + fn.expand_widget = function($widget, size_x, size_y, callback) { var wgd = $widget.coords().grid; - var max_size_x = Math.floor(($(window).width() - this.options.widget_margins[0] * 2) / - (this.min_widget_width + this.options.widget_margins[0] * 2)); - var size_x = Math.min(max_size_x, this.cols); + var max_size_x = Math.floor(($(window).width() - this.options.widget_margins[0] * 2) / this.min_widget_width); + size_x = size_x || Math.min(max_size_x, this.cols); size_y || (size_y = wgd.size_y); var old_size_y = wgd.size_y;