Open lordmatt opened 8 months ago
When you use jQuery and you get console error "obj is not iterable" or "h is not iterable" (minified version 5.0.0)
Solution:
let masonry = $( '.gallery' ).masonry();
let imgLoad = imagesLoaded( masonry[0] );
If anyone has multiple masonry/isotope grids on the same page, you'll have to use something like the below to apply imageLoaded to each individual instance:
var grids = document.querySelectorAll('.grid'); grids.forEach(function(grid) { var imgLoad = imagesLoaded(grid); // Progress event listener imgLoad.on('progress', function(instance, image) { // This function is triggered each time an image is loaded var result = image.isLoaded ? 'loaded' : 'failed'; console.log('An image ' + result + ' for grid', grid); // Optionally, you can update progress indicators here }); // Completion event listener imgLoad.on('always', function() { // Code to execute after all images in this grid have loaded console.log('All images loaded for grid', grid); }); });
👍
I'm seeing the following error in the console