Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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