jQuery(document).ready(function ($) { $('.justified').justifiedGallery({ rowHeight: 250, margins: 5, lastRow: 'center', captions: false }).on('jg.complete', function () { $('.justified').css('opacity', 1); const leftArrowSVGString = ''; const lightbox = new PhotoSwipeLightbox({ arrowPrevSVG: leftArrowSVGString, arrowNextSVG: leftArrowSVGString, gallery: '.imgGallery', children: 'a.imgLink', pswpModule: PhotoSwipe, captionContent: (slide) => { return slide.data.element.dataset.pswpCaption || ''; } }); lightbox.init(); }); });