BUGFIX: make masonry recalculate layout after image's loaded

This commit is contained in:
Changbai Li 2018-07-18 18:06:05 +08:00
parent 4dba144a34
commit c68ea392e8

View File

@ -35,10 +35,10 @@ function ViewMasonry()
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');
//this.msnry.layout(); this.msnry.layout();
console.log(this.msnry); 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)
{ {