$('.photoset-grid').each(function() {
$(this).magnificPopup({
delegate: 'a', // the container for each your gallery items
type: 'image',
gallery:{enabled:true},
// Delay in milliseconds before popup is removed
removalDelay: 300,
// Class that is added to popup wrapper and background
// make it unique to apply your CSS animations just to this exact popup
mainClass: 'mfp-fade'
});
});