jQuery(function() { jQuery('.custom-container img').each(function() { // For each image var a = jQuery(this).attr('src'); // Find its associated anchor jQuery(this).wrap('<a href="' + a + '"></a>'); // And wrap the image }); jQuery('.no_gal').each(function() { // For each image jQuery(this).parent('a').contents().unwrap(); }); }); jQuery('.custom-container').magnificPopup({ delegate: 'a', // child items selector, by clicking on it popup will open type: 'image', gallery:{ enabled:true } // other options });
admin Asked question March 29, 2021