mirror of
https://github.com/Aroy-Art/Rinkusu.git
synced 2025-04-28 18:17:48 +02:00
Fix masonry so it works if there are multiple grids on the same page
This commit is contained in:
parent
3de9992298
commit
1ce8d3af37
3 changed files with 14 additions and 12 deletions
|
@ -15,18 +15,20 @@ observer.observe();
|
|||
/* ========================================================================= */
|
||||
/* init Masonry for blog list
|
||||
/* ========================================================================= */
|
||||
var grid = document.querySelector('.blog-post');
|
||||
var grids = document.querySelectorAll('.masonry-grid');
|
||||
|
||||
if (grid) {
|
||||
var msnry = new Masonry(grid, {
|
||||
percentPosition: true
|
||||
});
|
||||
grids.forEach(function(grid) {
|
||||
if (grid) {
|
||||
var msnry = new Masonry(grid, {
|
||||
percentPosition: true
|
||||
});
|
||||
|
||||
imagesLoaded(grid).on('progress', function() {
|
||||
// layout Masonry after each image loads
|
||||
msnry.layout();
|
||||
});
|
||||
}
|
||||
imagesLoaded(grid).on('progress', function() {
|
||||
// layout Masonry after each image loads
|
||||
msnry.layout();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/* ========================================================================= */
|
||||
/* Image Preloader
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue