Created
April 5, 2017 11:36
-
-
Save robbens/343d2d3ac5aa03b79a3bf17a482daad4 to your computer and use it in GitHub Desktop.
Example on how to use Masonry.js with FacetWP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Init Masonry | |
var $grid = jQuery('.facetwp-template').masonry({ | |
percentPosition: true, | |
columnWidth: '.grid-sizer', | |
itemSelector: '.grid-item' | |
}); | |
// Reload and update on FacetWP load | |
jQuery(document).on('facetwp-loaded', function() { | |
$grid.masonry('reloadItems') | |
// Update Masonry layout after each image loads | |
$grid.imagesLoaded().progress( function() { | |
$grid.masonry('layout'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment