diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-09-01 14:38:18 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-09-01 14:38:18 +0200 |
| commit | 68f12e72e62172cb506dbfe6ed0f87c50502ed46 (patch) | |
| tree | c28709d669f92094bd6d9a05b31aa77962142ba2 /themes | |
| parent | 7fd03117de4889b92dfc93a0275ea2d1864bcffc (diff) | |
| download | pragblog-68f12e72e62172cb506dbfe6ed0f87c50502ed46.tar.gz pragblog-68f12e72e62172cb506dbfe6ed0f87c50502ed46.zip | |
attempt to fix layout on slow internet
Diffstat (limited to 'themes')
| -rw-r--r-- | themes/flog/layouts/partials/listing.html | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/themes/flog/layouts/partials/listing.html b/themes/flog/layouts/partials/listing.html index 58c7697..2ff3b3b 100644 --- a/themes/flog/layouts/partials/listing.html +++ b/themes/flog/layouts/partials/listing.html @@ -40,7 +40,8 @@ </div> </main> <script type="text/javascript"> - var masonryReadyAttached; + var masonryReadyAttached, + imageLoadAttached; if (typeof $ === 'undefined') { document.addEventListener('DOMContentLoaded', loadMasonry); @@ -51,6 +52,13 @@ } function loadMasonry() { + if (typeof imageLoadAttached === 'undefined') { + imageLoadAttached = true; + [].forEach.call(document.images, function(i) { + i.addEventListener('load', loadMasonry, false); + }); + } + if (typeof Masonry === 'undefined') { console.log('loading masonry files'); $.getScript('/js/masonry-4.1.min.js', showMasonry); |
