diff --git a/gridstack.css b/gridstack.css index 433cdce..ce1260c 100644 --- a/gridstack.css +++ b/gridstack.css @@ -88,7 +88,6 @@ .grid-stack-item[data-gs-x="2"] { left: 16.66666667% } .grid-stack-item[data-gs-x="1"] { left: 8.33333333% } - @media (max-width: 768px) { .grid-stack-item { position: relative !important; @@ -102,3 +101,20 @@ height: auto !important; } } + +.grid-stack.grid-stack-animate .grid-stack-item { + -webkit-transition: left .3s, top .3s, height .3s, width .3s; + -moz-transition: left .3s, top .3s, height .3s, width .3s; + -o-transition: left .3s, top .3s, height .3s, width .3s; + -ms-transition: left .3s, top .3s, height .3s, width .3s; + transition: left .3s, top .3s, height .3s, width .3s; +} +/*Don't animate the placeholder or when dragging/resizing*/ +.grid-stack.grid-stack-animate .grid-stack-item.ui-draggable-dragging, +.grid-stack.grid-stack-animate .grid-stack-item.ui-resizable-resizing, +.grid-stack.grid-stack-animate .grid-stack-item.grid-stack-placeholder{ + -webkit-transition: left .0s, top .0s, height .0s, width .0s; + -moz-transition: left .0s, top .0s, height .0s, width .0s; + -o-transition: left .0s, top .0s, height .0s, width .0s; + transition: left .0s, top .0s, height .0s, width .0s; +} diff --git a/gridstack.js b/gridstack.js index 38e7264..3ab1cba 100644 --- a/gridstack.js +++ b/gridstack.js @@ -283,7 +283,8 @@ auto: true, min_width: 768, float: false, - _class: 'grid-stack-' + (Math.random() * 10000).toFixed(0) + _class: 'grid-stack-' + (Math.random() * 10000).toFixed(0), + animate: Boolean(this.container.attr('data-gs-animate')) || false }); this.container.addClass(this.opts._class); @@ -324,6 +325,8 @@ }); } + this.set_animation(this.opts.animate); + this.placeholder = $('