Мне данное решение немного не подошло (я не смог прикрутить к нему опции для видео итд), но в принципе оно рабочее, по крайней мере из того что смог найти, может кому пригодится:
$('.product-tab-gallery').each(function() {
var items = [];
var $gallery = $(this);
// Get links
$gallery.find('a.imageitem').each(function() {
items.push($(this).attr('href'));
});
var uniqueItems = [];
// Remove duplicates
$.each(items, function(i, el) {
if($.inArray(el, uniqueItems) === -1) {
uniqueItems.push(el);
}
});
items = [];
// Put in Magnific format
$.each(uniqueItems, function(i, el) {
items.push({
src: el,
type: 'image'
});
});
// Assign an index to each link so the clicked one is shown first
$gallery.find('a.imageitem').each(function() {
var $a = $(this);
$.each(items, function(i, el) {
if (el.src == $a.attr('href')) {
$a.data('index', i);
return;
}
});
});
$gallery.on('click', 'a.imageitem', function(e) {
e.preventDefault();
var $a = $(this);
$.magnificPopup.open({
type: 'image',
items: items,
gallery: {
enabled: true
}
});
$.magnificPopup.instance.goTo($a.data('index'));
});
});