From 0088deee17500d5e303ad0cadcebb0f2f8707938 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Thu, 18 Jun 2015 19:31:46 -0700 Subject: [PATCH] update gridstack.js --- gridstack.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gridstack.js b/gridstack.js index 4587c48..51026e6 100644 --- a/gridstack.js +++ b/gridstack.js @@ -5,7 +5,7 @@ (function (factory) { if (typeof define === 'function' && define.amd) { - define(['jquery', 'lodash'], factory); + define(['jquery', 'lodash', 'jquery-ui/core', 'jquery-ui/widget', 'jquery-ui/mouse', 'jquery-ui/draggable', 'jquery-ui/resizable'], factory); } else { factory(jQuery, _); @@ -445,7 +445,6 @@ this.set_animation(this.opts.animate); this.placeholder = $('
').hide(); - this.container.append(this.placeholder); this.container.height((this.grid.get_grid_height()) * (this.opts.cell_height + this.opts.vertical_margin) - this.opts.vertical_margin); var on_resize_handler = function () { @@ -550,7 +549,7 @@ }; GridStack.prototype._is_one_column_mode = function () { - return $(window).width() <= this.opts.min_width; + return (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= this.opts.min_width; }; GridStack.prototype._prepare_element = function (el) { @@ -579,6 +578,7 @@ var cell_width, cell_height; var on_start_moving = function (event, ui) { + self.container.append(self.placeholder); var o = $(this); self.grid.clean_nodes(); self.grid.begin_update(node); @@ -597,6 +597,7 @@ }; var on_end_moving = function (event, ui) { + self.placeholder.detach(); var o = $(this); node.el = o; self.placeholder.hide();