import Masonry from 'masonry-layout';

(function ($) {
	'use strict';

	$(document).ready(function () {
		var container =
			'.flo-block-related-grid.flo-block-related-grid--masonry .flo-block-related-grid__items';

		const initMasonry = () => {
			new Masonry(container, {
				itemSelector: '.flo-block-post-grid__item',
				transitionDuration: '0.2s',
				percentPosition: true,
			});
		};
		if ($(container).length) {
			$(container).find('img').on('load', initMasonry);
			initMasonry();
		}
	});
})(jQuery);
