From 37ee9883fdeed81798560bd9d51364a97067b97f Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Tue, 11 Nov 2014 19:05:15 -0800 Subject: [PATCH] add `auto` option --- gridstack.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gridstack.js b/gridstack.js index 60af6ee..28890e4 100644 --- a/gridstack.js +++ b/gridstack.js @@ -169,7 +169,8 @@ placeholder_class: 'grid-stack-placeholder', handle: '.grid-stack-item-content', cell_height: 60, - vertical_margin: 20 + vertical_margin: 20, + auto: true }); this.grid = new GridStackEngine(this.opts.width, function (nodes) { @@ -182,9 +183,11 @@ }); }); - this.container.find('.' + this.opts.item_class).each(function (index, el) { - self._prepare_element(el); - }); + if (this.opts.auto) { + this.container.find('.' + this.opts.item_class).each(function (index, el) { + self._prepare_element(el); + }); + } this.placeholder = $('
').hide(); this.container.append(this.placeholder);