Events

Shuffle emits an event when a layout happens and when elements are removed. The event names are Shuffle.EventType.LAYOUT and Shuffle.EventType.REMOVED.

Shuffle uses the global CustomEvent to create events. A polyfill for IE<=11 is bundled with Shuffle.

Get notified when a layout happens

element.addEventListener(Shuffle.EventType.LAYOUT, function () {
  console.log('Things finished moving!');
});

Do something when an item is removed

element.addEventListener(Shuffle.EventType.REMOVED, function (evt) {
  var detail = evt.detail;
  console.log(this, evt, detail.collection, detail.shuffle);
});