How to make a Swiper initialization inside Magnific Popup?

Hello. There is a gallery modal Windows Magnific Popup. You can open them all individually, or open one and inside flipping.
$('.open-example').magnificPopup({
 mainClass: 'mfp-fade',
 type: 'inline',
gallery:{
 enabled: true,
 arrows: false
},
 callbacks: {
 beforeOpen: function(){
$(window).trigger('resize');
}
}
});

 $('.prev-proj').on('click', function(e) {
e.preventDefault();
$.magnificPopup.instance.prev();
 return false;
});

 $('.next-proj').on('click', function(e) {
e.preventDefault();
$.magnificPopup.instance.next();
 return false;
 });


Inside each slide is made of slider:
var galleryTop = new Swiper('.gallery-top', {

loop:true,
 loopedSlides: 6,
 navigation: {
 nextEl: '.swiper-button-next',
 prevEl: '.swiper-button-prev',
},
});
 var galleryThumbs = new Swiper('.gallery-thumbs', {
 spaceBetween: 20,
loop:true,
 loopedSlides: 6,
 slidesPerView: 3,
 touchRatio: 0.2,
 slideToClickedSlide: true,
});
 galleryTop[0].controller.control = galleryThumbs;
 galleryThumbs[1].controller.control = galleryTop;

Well, when you switch slides magnifica broken internal slider. How to be? I sin on these lines, but not sure
galleryTop[0].controller.control = galleryThumbs;
galleryThumbs[1].controller.control = galleryTop;

Just if you remove the [0] and [1], gives "Cannot set property 'control' of undefined"
June 8th 19 at 17:15
1 answer
June 8th 19 at 17:17
Good.

Solved the problem?

Find more questions by tags jQuery