From 41a183b22d408aebf57ed2d04b85cc0a91f55af3 Mon Sep 17 00:00:00 2001 From: Eric Mann Date: Fri, 6 Mar 2015 12:22:29 -0800 Subject: [PATCH] Add an optional final parameter to add_widget. --- src/jquery.gridster.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 6f59b1afb..3edb05397 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -324,14 +324,19 @@ * @param {Array} [max_size] max_size Maximun size (in units) for width and height. * @param {Array} [min_size] min_size Minimum size (in units) for width and height. * @param {string} [model_id] reference to backbone model. + * @param {Boolean} [fade_in] fade the widget into view immediately. * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing. * the widget that was just created. */ - fn.add_widget = function(html, size_x, size_y, col, row, max_size, min_size, model_id) { + fn.add_widget = function(html, size_x, size_y, col, row, max_size, min_size, model_id, fade_in) { var pos; size_x || (size_x = 1); size_y || (size_y = 1); + if ( undefined === fade_in ) { + fade_in = true; + } + if (!col & !row) { pos = this.next_position(size_x, size_y); } else { @@ -373,7 +378,11 @@ this.drag_api.set_limits(this.cols * this.min_widget_width); - return $w.fadeIn(); + if ( fade_in ) { + return $w.fadeIn(); + } else { + return $w; + } };