<div class="grid">
  <div class="item">
    <div class="item-content">1</div>
  </div>
  <div class="item">
    <div class="item-content">2</div>
  </div>
  <div class="item">
    <div class="item-content">3</div>
  </div>
  <div class="item">
    <div class="item-content">4</div>
  </div>
  <div class="item">
    <div class="item-content">5</div>
  </div>
  <div class="item">
    <div class="item-content">6</div>
  </div>
  <div class="item">
    <div class="item-content">7</div>
  </div>
  <div class="item">
    <div class="item-content">8</div>
  </div>
  <div class="item">
    <div class="item-content">9</div>
  </div>
  <div class="item">
    <div class="item-content">10</div>
  </div>
  <div class="item">
    <div class="item-content">11</div>
  </div>
  <div class="item">
    <div class="item-content">12</div>
  </div>
  <div class="item">
    <div class="item-content">13</div>
  </div>
  <div class="item">
    <div class="item-content">14</div>
  </div>
  <div class="item">
    <div class="item-content">15</div>
  </div>
  <div class="item">
    <div class="item-content">16</div>
  </div>
  <div class="item">
    <div class="item-content">17</div>
  </div>
  <div class="item">
    <div class="item-content">18</div>
  </div>
  <div class="item">
    <div class="item-content">19</div>
  </div>
  <div class="item">
    <div class="item-content">20</div>
  </div>
</div>
.grid {
  position: relative;
}
.item {
  position: absolute;
  width: 200px;
  height: 200px;
  line-height: 200px;
  margin: 5px;
  z-index: 1;
}
.item.muuri-item-hidden {
  z-index: 0;
}
.item.muuri-item-releasing {
  z-index: 2;
}
.item.muuri-item-dragging {
  z-index: 3;
}
.item-content {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  background: red;
  font-size: 50px;
  color: white;
  cursor: pointer;
}
.item.muuri-item-dragging .item-content {
  background: blue;
}
.item.muuri-item-releasing .item-content {
  background: blueViolet;
}
var grid = new Muuri('.grid', {
  dragEnabled: true
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/web-animations/2.3.2/web-animations.min.js
  2. https://cdn.jsdelivr.net/gh/haltu/[email protected]/dist/muuri.min.js