I'm using masonry to show a grid of images which sometimes have an resolution of 1920x1080 but they're not loading completely. I cant provide a codepen but I'll provide a screenshot and my code.
Images getting loaded from Amazon S3 service, when I put them inside my own server it works as expected. So I'm not sure if it has to do with S3 or masonry not loading correctly from third party servers?
I'm using masonry to show a grid of images which sometimes have an resolution of 1920x1080 but they're not loading completely. I cant provide a codepen but I'll provide a screenshot and my code.
Screenshot: https://i.imgur.com/ld6HG5I.png Code:
$( document ).ready(function() { var $grid = $('.grid').masonry({ itemSelector: '.grid-item', columnWidth: '.grid-sizer', percentPosition: true, isResizable: true, transitionDuration: '0.8s', isAnimated: true }); });
HTML CODE: `
Images getting loaded from Amazon S3 service, when I put them inside my own server it works as expected. So I'm not sure if it has to do with S3 or masonry not loading correctly from third party servers?
I've found a solution.
Step 1: Implement imagesLoaded script https://imagesloaded.desandro.com/
Step 2: var $grid = $('.grid').imagesLoaded( function() { // init Masonry after all images have loaded $grid.masonry({ // options... }); });
source: https://stackoverflow.com/questions/40130622/masonry-with-asynchronous-picture-loading