Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Created February 5, 2018 22:32
Show Gist options
  • Save zackkatz/7e48220bd153b4f63a24ecb3ea147d6f to your computer and use it in GitHub Desktop.
Save zackkatz/7e48220bd153b4f63a24ecb3ea147d6f to your computer and use it in GitHub Desktop.
GravityView DIY Layout - Add this to a Custom Content widget to look like the DIY Layout demo
<!-- Turn your DIY Layout into a "Isotope Masonry Layout", as seen on https://demo.gravityview.co/view/diy/ -->
<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script>
<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
<script>
jQuery( document ).ready( function( $ ) {
// Fixed Layout
var $grid = $('.gv-diy-container').isotope({
// options...
itemSelector: '.gv-diy-view',
masonry: {
columnWidth: 150
}
});
// layout Isotope after each image loads
$grid.imagesLoaded().progress( function() {
$grid.isotope('layout');
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment