From a3bcd4f626d7a31627058b752e7c8cc7a0257b48 Mon Sep 17 00:00:00 2001 From: kor Date: Thu, 19 Jul 2018 00:10:24 +1200 Subject: [PATCH] window.onload call msnry.layout() to fix image grid-item div squashed bug. --- logic/viewmasonry.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/logic/viewmasonry.js b/logic/viewmasonry.js index a0d972e..cd0b53d 100644 --- a/logic/viewmasonry.js +++ b/logic/viewmasonry.js @@ -30,13 +30,14 @@ function ViewMasonry() transitionDuration: 0, }); + /////////////////////////// + // Fix squashed image divs var imgLoad = imagesLoaded('.grid'); - function onAlways( instance ) - { - this.msnry.layout(); - } - imgLoad.on( 'always', onAlways.bind(this) ); - // imgLoad.off( 'always', onAlways ); + imgLoad.on( 'always', function (instance) { parent.msnry.layout(); } ); + // Above imgLoad on always msnry.layout() should work but occassionally doesn't in Chrome and NEVER does in Firefox. + window.onload = function () { parent.msnry.layout(); } + // msnry.layout() called by window onload fixes things but not ideal. + /////////////////////////// } }