mirror of
https://github.com/TangentFoxy/memex.git
synced 2024-11-22 04:54:23 +00:00
Merge pull request #1 from dotcli/bugfix/masonry-layout-refresh.
BUGFIX: make masonry recalculate layout after image's loaded
This commit is contained in:
commit
a2f46b1281
@ -31,21 +31,21 @@ function ViewMasonry()
|
||||
fitWidth: true,
|
||||
transitionDuration: 0,
|
||||
});
|
||||
console.log(3 + ' ' + this.msnry);
|
||||
console.log(3);
|
||||
|
||||
// var imgLoad = imagesLoaded('.grid');
|
||||
// function onAlways( instance ) {
|
||||
// console.log('all images are loaded');
|
||||
// parent.msnry.reloadItems();
|
||||
// parent.msnry.layout();
|
||||
// }
|
||||
// imgLoad.on( 'always', onAlways );
|
||||
// // imgLoad.off( 'always', onAlways );
|
||||
// imgLoad.on( 'progress', function(instance, image)
|
||||
// {
|
||||
// var result = image.isLoaded ? 'loaded' : 'broken';
|
||||
// console.log( 'image is ' + result + ' for ' + image.img.src );
|
||||
// });
|
||||
var imgLoad = imagesLoaded('.grid');
|
||||
function onAlways( instance ) {
|
||||
console.log('all images are loaded');
|
||||
this.msnry.layout();
|
||||
console.log(this.msnry);
|
||||
}
|
||||
imgLoad.on( 'always', onAlways.bind(this) );
|
||||
// imgLoad.off( 'always', onAlways );
|
||||
imgLoad.on( 'progress', function(instance, image)
|
||||
{
|
||||
var result = image.isLoaded ? 'loaded' : 'broken';
|
||||
console.log( 'image is ' + result + ' for ' + image.img.src );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user