DEMO
The problem you are encountering is that you are asking Swiper
to recalculate its size at a moment when its not visible, and therefore has no size. So we need to be calling resizeFix
at a moment when the element is visible. To do this wait 16ms
(or one frame) of the fadeIn animation to call resizeFix
, that way its the minimum partially visible, and Swiper
can determine its new size.
var $eld = $("#experience-left-details");
$eld.on('click', '.see-map, .see-gallery', function (event) {
event.preventDefault();
$eld.fadeOut(
function(){
$(".media-container, .swiper-container").toggleClass('hide');
// wait one frame to resize
setTimeout(function(){
mySwiper.reInit(true);
mySwiper.resizeFix(true);
}, 16);
}
).fadeIn();
});