Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 1.44 KB

README.md

File metadata and controls

76 lines (52 loc) · 1.44 KB

Packery

Bin-packing layout library

See packery.metafizzy.co for complete docs and demos

Install

Download

CDN

Link directly to Packery files on unpkg.

<script src="https://unpkg.com/packery@3/dist/packery.pkgd.js"></script>
<!-- or -->
<script src="https://unpkg.com/packery@3/dist/packery.pkgd.min.js"></script>

Package managers

npm: npm install packery --save

Bower: bower install packery --save

License

Packery v3 is licensed under the MIT license.

Initialize

With jQuery

$('.grid').packery({
  // options...
  itemSelector: '.grid-item'
});

With vanilla JavaScript

// vanilla JS
var grid = document.querySelector('.grid');
// initialize with element
var pckry = new Packery( grid, {
  // options...
  itemSelector: '.grid-item'
});

// initialize with selector string
var pckry = new Packery('.grid', {
  // options...
});

With HTML

Add a data-packery attribute to your element. Options can be set in JSON in the value.

<div class="grid" data-packery='{ "itemSelector": ".grid-item" }'>
  <div class="grid-item"></div>
  <div class="grid-item"></div>
  ...
</div>

By Metafizzy