({src: el.getAttribute('data-fancy-src'),type: 'image'}));const activeIndex = images.findIndex(img => img.src === activeSlide.getAttribute('data-fancy-src'));Fancybox.show(images, {startIndex: activeIndex >= 0 ? activeIndex : 0,Carousel: {transition: "classic"},animationEffect: "zoom",animationDuration: 500,transitionEffect: "slide",transitionDuration: 400,Toolbar: {display: ["zoom","fullscreen","close"]},Thumbs: {autoStart: false}});}});} else { }Fancybox.bind("[data-fancybox='gallery']", {Carousel: {transition: "classic"},animationEffect: "zoom",animationDuration: 500,transitionEffect: "slide",transitionDuration: 400,Toolbar: {display: ["zoom","fullscreen","close"]},Thumbs: {autoStart: false}});}});function CHANGE_VARIANT(){var selected_options = [];$(".size-option.active").each(function(){var option = $(this).find("span").text();selected_options.push(option);});var selected_variant = {};var selected_variant_id = $(".size-option.active").attr("vt-id");for (let index = 0; index < PRODUCT.variants.length; index++) {if (parseInt(selected_variant_id) === parseInt(PRODUCT.variants[index].id) ){selected_variant = PRODUCT.variants[index];}} if (selected_variant.id && selected_variant.available) {$(".cart-button-wrapper .drawer-checkout").attr("vt-id", selected_variant.id);$(".cart-button-wrapper .drawer-checkout").attr("stock", "true");}else { $(".cart-button-wrapper .drawer-checkout").attr("stock", "false");} const priceElement = $('#product-template span.title.sale-price');const variantPrice = $(".size-option.active").attr("vt-price"); if (variantPrice) {priceElement.text(variantPrice);} } var showSlider = false;if ((window.innerWidth <= 900 || showSlider )) {var main_image_slider = $("#product-template .main-image-wrapper").slick({infinite: false,swipeToSlide: true,accessibility: false,slidesToShow: 1,arrows: false,fade: true,autoplay: false,speed: 1000,asNavFor: "#product-template .thumbnail-wrapper",});var thumbnail_slider = $("#product-template .thumbnail-wrapper").slick({infinite: false,swipeToSlide: true,accessibility: false,slidesToShow: 4.5,arrows: false,asNavFor: "#product-template .main-image-wrapper",autoplay: false, focusOnSelect: true});$("#product-template .thumbnail-wrapper .image-block").on("click", function(){var index = $(this).attr("data-slick-index");main_image_slider.slick("slickGoTo", index)});window.onscroll = function () {var offset_top = $(".cart-button-wrapper .klarna-widget").offset().top;if (window.scrollY > (offset_top + 20)){$(".cart-button-wrapper .drawer-checkout").addClass("sticky");}else {$(".cart-button-wrapper .drawer-checkout").removeClass("sticky");}}}$(".dropdown-title").on("click", function(){$(this).toggleClass("open");$(this).next().slideToggle();});$(".size-option").on("click", function(){$(this).closest(".size-swatch").find(".size-option").removeClass("active");$(this).addClass("active");CHANGE_VARIANT();});$(".upsell-button").on("click", function(){var selected_vt_id = $(this).closest(".upsell-cart-wrapper").find("select").val(); QUICK_CART(selected_vt_id, 1);});$(".color-swatch > label").on("click", function(){$(".color-swatch").toggleClass("closed");});const swatches = ["WEISS","BABY BLAU","SCHWARZ","KOHLE","GRAU","NAVY","PINK","RED","TÜRKIS","ORANGE","OLIVE","NAVY","LIME","GREY","GREEN","CHARCOAL","BLACK","SAGE","BURGUNDY"];const handles = ["Herren-clima-shorts-weiss","Herren-clima-shorts-baby-blau-1","Herren-clima-shorts-schwarz","Herren-clima-shorts-Kohle","Herren-clima-shorts-grau","Herren-clima-shorts-navy","Herren-clima-shorts-pink-1","clima-golf-shorts-red","Herren-Klimashorts-türkis","clima-golf-shorts-orange","clima-golf-shorts-olive","mens-clima-shorts-navy","clima-golf-shorts-lime","mens-clima-shorts-grey","clima-golf-shorts-green","clima-golf-shorts-charcoal","mens-clima-shorts-black","clima-golf-shorts-sage","clima-golf-shorts-burgundy"];function GET_SWATCH_HTML(handle, swatch) {var swatchUrl = `${window.Shopify.routes.root}products/${handle}/?section_id=swatch-html-api`;$.ajax({url: swatchUrl,type: 'GET',}).then(res => {var res_wrapper = document.createElement('div');res_wrapper.innerHTML = res;$('.swatch-colors').append(res_wrapper);$(".swatch-colors .swatch-wrapper[product-id=1862927220797]").addClass("active");});}for (let index = 0; index < swatches.length; index++) {var handle = handles[index];var swatch = swatches[index];if (handle && swatch) {GET_SWATCH_HTML(handle, swatch);}} $(document).ready(function() { var hasBeenAdded = false;$('#fancy-box-link').on('click', function() {if (!hasBeenAdded) { var truefitContent = $('.truefit-box').html();$('.size-chart-wrap h5.title.left').append(truefitContent);hasBeenAdded = true; }});});