diff --git a/assets/js/script.js b/assets/js/script.js index 0d9f62f..a568a39 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -34,25 +34,29 @@ window.onload = async function () { scrollBack(); navInvestigation(); - var elem = document.querySelector('.grid-masonry'); - var msnry = null; + var elems = document.querySelectorAll('.grid-masonry'); + var msnries = []; function initMasonry() { - if (!elem) return; + if (!elems.length) return; if (window.innerWidth >= responsiveSmall) { - if (!msnry) { - msnry = new Masonry(elem, { - itemSelector: '.card--block:not(.is-sort-hidden)', - columnWidth: '.grid-sizer', - percentPosition: true, - gutter: 26 - }); - } + elems.forEach(function(elem, i) { + if (!msnries[i]) { + msnries[i] = new Masonry(elem, { + itemSelector: '.card--block:not(.is-sort-hidden)', + columnWidth: '.grid-sizer', + percentPosition: true, + gutter: 26 + }); + } + }); } else { - if (msnry) { - msnry.destroy(); - msnry = null; - } + msnries.forEach(function(msnry, i) { + if (msnry) { + msnry.destroy(); + msnries[i] = null; + } + }); } } @@ -60,10 +64,12 @@ window.onload = async function () { window.addEventListener('resize', initMasonry); initSort(() => { - if (msnry) { - msnry.reloadItems(); - msnry.layout(); - } + msnries.forEach(function(msnry) { + if (msnry) { + msnry.reloadItems(); + msnry.layout(); + } + }); }); diff --git a/site/templates/home.php b/site/templates/home.php index 045e8cd..e9de61f 100644 --- a/site/templates/home.php +++ b/site/templates/home.php @@ -185,7 +185,6 @@ $count = max(4, (int)$section->count()->value()); -