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..9e5ceb9a1 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: 20px; ' + + '}' + + '.grid-stack-item .ui-resizable-handle { display: none; } ' + + '.grid-stack { height: auto !important; }', + 0); }; GridStack.prototype._update_container_height = function() {