From 43b2f0b6ee806e256a04a4b828bb2fb9fdc7056c Mon Sep 17 00:00:00 2001 From: Dylan Weiss Date: Tue, 19 May 2015 17:40:04 -0400 Subject: [PATCH 1/2] $(window).width() is incorrect by about 5 pixels, causing _is_one_column_mode to be incorrect. To test this, go to any gridstack and make the page width 769px. Single column mode via CSS will not kick in, yet elements will not be draggable. --- src/gridstack.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gridstack.js b/src/gridstack.js index 4587c48..4afdcfc 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -550,7 +550,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) { From 0f2f04fa50efb68806ac1eea52025ae6cbe12e85 Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Thu, 28 May 2015 23:53:37 +0300 Subject: [PATCH 2/2] Fix typos in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index be12de8..734450f 100644 --- a/README.md +++ b/README.md @@ -118,14 +118,14 @@ $(function () { - `animate` - turns animation on (default: `false`) - `auto` - if `false` it tells to do not initialize existing items (default: `true`) - `cell_height` - one cell height (default: `60`) -- `draggable` - allows to owerride jQuery UI draggable options. (default: `{handle: '.grid-stack-item-content', scroll: true, appendTo: 'body'}`) +- `draggable` - allows to override jQuery UI draggable options. (default: `{handle: '.grid-stack-item-content', scroll: true, appendTo: 'body'}`) - `handle` - draggable handle selector (default: `'.grid-stack-item-content'`) - `height` - maximum rows amount. Default is `0` which means no maximum rows - `float` - enable floating widgets (default: `false`) See [example](http://troolee.github.io/gridstack.js/demo/float.html) - `item_class` - widget class (default: `'grid-stack-item'`) - `min_width` - minimal width. If window width is less grid will be shown in one-column mode (default: `768`) - `placeholder_class` - class for placeholder (default: `'grid-stack-placeholder'`) -- `resizable` - allows to owerride jQuery UI resizable options. (default: `{autoHide: true, handles: 'se'}`) +- `resizable` - allows to override jQuery UI resizable options. (default: `{autoHide: true, handles: 'se'}`) - `vertical_margin` - vertical gap size (default: `20`) - `width` - amount of columns (default: `12`)