';
output_thumb += '';
output_thumb += '

';
output_thumb += '
';
usedImages.push( changeVariation['full_src'] );
}
});
});
}
// Get image gallery
$.each( images, function ( index, image ) {
if ( image['single'] == undefined ) {
var img_single = image['thumbnail'];
} else {
var img_single = image['single'];
}
if ( $.inArray( img_single, usedImages ) === -1 ) {
output_gal += '';
output_thumb += '';
output_thumb += '

';
output_thumb += '
';
usedImages.push( img_single );
if (changeVariation && changeVariation['gallery_thumbnail_src'] == image['thumbnail']) {
changeVariation = index;
}
}
});
if ( window._inQuickview ) {
var output = '' + output_gal + '
';
} else {
var output = '' + output_gal + '
';
}
output += '' + output_thumb + '
';
$( '#product-' + productId + ' .single-product-thumbnail' ).html( output );
setTimeout(function() {
$( '.jas-carousel' ).not( '.slick-initialized' ).slick({focusOnSelect: true});
if ($.isNumeric(changeVariation)) {
//$( '.jas-carousel' ).slick( 'slickGoTo', changeVariation );
}
if ( $( '.jas-image-zoom' ).length > 0 && ! window._inQuickview ) {
$( '.jas-image-zoom' ).zoom({
touch: false,
});
}
// Reset the index of image on product variation
$( 'body' ).on( 'found_variation', '.variations_form', function( ev, variation ) {
if ( variation && variation.image && variation.image.src && variation.image.src.length > 1 ) {
var exist = $('.jas-carousel.p-thumb .p-item img[data-large_image="'+variation.image.full_src+'"]');
if (exist.length > 0) {
var index = exist.parents('.p-item').attr('data-slick-index');
$( '.jas-carousel' ).slick( 'slickGoTo', index);
}
}
});
}, 10);
// Trigger gallery
if ( $( '.woocommerce-product-gallery' ).length > 0 && ! window._inQuickview ) {
$( '.woocommerce-product-gallery' ).each( function () {
$( this ).wc_product_gallery();
});
$( 'body' ).on( 'click', '.pswp__container, .pswp__button--close', function() {
$( '.pswp' ).removeAttr( 'class' ).addClass( 'pswp' );
});
}
});
})( jQuery );