Merge pull request from dotcli/bugfix/masonry-layout-refresh.

BUGFIX: make masonry recalculate layout after image's loaded
This commit is contained in:
Hamish MacDonald 2018-07-18 22:58:43 +12:00 committed by GitHub
commit a2f46b1281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,21 +31,21 @@ function ViewMasonry()
fitWidth: true, fitWidth: true,
transitionDuration: 0, transitionDuration: 0,
}); });
console.log(3 + ' ' + this.msnry); console.log(3);
// var imgLoad = imagesLoaded('.grid'); var imgLoad = imagesLoaded('.grid');
// function onAlways( instance ) { function onAlways( instance ) {
// console.log('all images are loaded'); console.log('all images are loaded');
// parent.msnry.reloadItems(); this.msnry.layout();
// parent.msnry.layout(); console.log(this.msnry);
// } }
// imgLoad.on( 'always', onAlways ); imgLoad.on( 'always', onAlways.bind(this) );
// // imgLoad.off( 'always', onAlways ); // imgLoad.off( 'always', onAlways );
// imgLoad.on( 'progress', function(instance, image) imgLoad.on( 'progress', function(instance, image)
// { {
// var result = image.isLoaded ? 'loaded' : 'broken'; var result = image.isLoaded ? 'loaded' : 'broken';
// console.log( 'image is ' + result + ' for ' + image.img.src ); console.log( 'image is ' + result + ' for ' + image.img.src );
// }); });
} }
} }