www.netz39.de/assets/js/partials/masonry_init.js

23 lines
550 B
JavaScript
Raw Permalink Normal View History

2023-10-16 01:36:59 +02:00
/* @preserve Masonry Init */
try {
var elem = document.querySelector('.grid');
var msnry = new Masonry(elem, {
itemSelector: '.grid-item',
columnWidth: '.grid-sizer',
gutter: '.gutter-sizer',
percentPosition: true
});
// layout Masonry after each image loads
var imgLoad = imagesLoaded(elem);
imgLoad.on('progress', function (instance, image) {
msnry.layout();
});
} catch (err) {
if (err instanceof ReferenceError) {
// Do nothing, Masonry is defined only in the gallery page
} else {
throw err;
}
}