From 5852c3f38aaa29f4b2a31ee6bc5a19d3f5a4ae84 Mon Sep 17 00:00:00 2001 From: Joseph Denton Date: Thu, 3 Sep 2015 15:08:26 -0700 Subject: [PATCH 1/2] removed manual media query and added a dynamic media query generated in '_update_styles' --- src/gridstack.css | 16 ---------------- src/gridstack.js | 12 ++++++++++++ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/gridstack.css b/src/gridstack.css index 50d468ee8..b977ce2fa 100644 --- a/src/gridstack.css +++ b/src/gridstack.css @@ -300,19 +300,3 @@ @include vendor(transform, rotate(180deg)); } */ -@media (max-width: 768px) { - .grid-stack-item { - position: relative !important; - width: auto !important; - left: 0 !important; - top: auto !important; - margin-bottom: 20px; - } - .grid-stack-item .ui-resizable-handle { - display: none; - } - - .grid-stack { - height: auto !important; - } -} diff --git a/src/gridstack.js b/src/gridstack.js index 9b338a767..c48098882 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -582,6 +582,18 @@ } this._styles._max = max_height; } + + Utils.insert_css_rule(this._styles, '@media (max-width: ' + this.opts.min_width + 'px)', + '.grid-stack-item { ' + + 'position: relative !important; ' + + 'width: auto !important; ' + + 'left: 0 !important; ' + + 'top: auto !important; ' + + 'margin-bottom: $vertical_padding; ' + + '}' + + '.grid-stack-item .ui-resizable-handle { display: none; } ' + + '.grid-stack { height: auto !important; }', + 0); }; GridStack.prototype._update_container_height = function() { From 87014e873be8436f3ff48472cc15c1dae506bb4a Mon Sep 17 00:00:00 2001 From: Joseph Denton Date: Thu, 3 Sep 2015 15:15:22 -0700 Subject: [PATCH 2/2] fixing extraction remnant --- src/gridstack.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gridstack.js b/src/gridstack.js index c48098882..9e5ceb9a1 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -589,7 +589,7 @@ 'width: auto !important; ' + 'left: 0 !important; ' + 'top: auto !important; ' + - 'margin-bottom: $vertical_padding; ' + + 'margin-bottom: 20px; ' + '}' + '.grid-stack-item .ui-resizable-handle { display: none; } ' + '.grid-stack { height: auto !important; }',