Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0088dee

Browse files
committed
update gridstack.js
1 parent 86d957a commit 0088dee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

gridstack.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
(function (factory) {
77
if (typeof define === 'function' && define.amd) {
8-
define(['jquery', 'lodash'], factory);
8+
define(['jquery', 'lodash', 'jquery-ui/core', 'jquery-ui/widget', 'jquery-ui/mouse', 'jquery-ui/draggable', 'jquery-ui/resizable'], factory);
99
}
1010
else {
1111
factory(jQuery, _);
@@ -445,7 +445,6 @@
445445
this.set_animation(this.opts.animate);
446446

447447
this.placeholder = $('<div class="' + this.opts.placeholder_class + ' ' + this.opts.item_class + '"><div class="placeholder-content" /></div>').hide();
448-
this.container.append(this.placeholder);
449448
this.container.height((this.grid.get_grid_height()) * (this.opts.cell_height + this.opts.vertical_margin) - this.opts.vertical_margin);
450449

451450
var on_resize_handler = function () {
@@ -550,7 +549,7 @@
550549
};
551550

552551
GridStack.prototype._is_one_column_mode = function () {
553-
return $(window).width() <= this.opts.min_width;
552+
return (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= this.opts.min_width;
554553
};
555554

556555
GridStack.prototype._prepare_element = function (el) {
@@ -579,6 +578,7 @@
579578
var cell_width, cell_height;
580579

581580
var on_start_moving = function (event, ui) {
581+
self.container.append(self.placeholder);
582582
var o = $(this);
583583
self.grid.clean_nodes();
584584
self.grid.begin_update(node);
@@ -597,6 +597,7 @@
597597
};
598598

599599
var on_end_moving = function (event, ui) {
600+
self.placeholder.detach();
600601
var o = $(this);
601602
node.el = o;
602603
self.placeholder.hide();

0 commit comments

Comments
 (0)