$(document).ready(function() { $(.justifiedGallery).justifiedGallery({ lastRow : 'nojustify', rowHeight : 250, margins : 5 }).on('jg.complete', function () { $(this).find('a').colorbox({ maxWidth: '80%', maxHeight: '80%', opacity: 0.8, transition: 'elastic', current: '' }); }); });