EXAMPLES
LAYER

Layer

layer.js exposes a global Layer. animal.js adds Selection.layer() to bind click-to-popup.

Layer example
JavaScript
HTML
const $ = animal;

// 1) Bind click popup (recommended for buttons / links)
$('.btn-delete').layer({
  title: 'Delete item?',
  text: 'This action cannot be undone.',
  icon: 'warning',
  showCancelButton: true
});

// 2) Bind from data-* (no JS options needed)
$('.btn-data').layer(); // reads data-layer-* attributes

// 3) Fire directly (manual usage)
document.querySelector('.btn-direct').addEventListener('click', () => {
  $.layer({ title: 'Hello from $.layer()', icon: 'success' });
});
<button class="btn danger btn-delete">Delete (bind .layer)</button>

<button
  class="btn btn-data"
  data-layer-title="Data-driven popup"
  data-layer-text="Configured via data-layer-* attributes"
  data-layer-icon="success"
>Open (data-layer-*)</button>

<button class="btn btn-direct">Open ($.layer)</button>
Make sure you included both animal.js and layer.js. For click-binding, $('.btn').layer(options) will de-dupe old handlers if called again.