1jQuery( function($) { 2 3 "use strict"; 4 5 var classes = $(".custom-layout .mobile_gallery .woocommerce-product-gallery").attr("class"); 6 var ol_classes = $(".custom-layout .mobile_gallery .flex-control-thumbs").attr("class"); 7 8 $(window).on('resize', function() { 9 if ($(window).width() <= 1024) { 10 $(".custom-layout .mobile_gallery > div").addClass(classes); 11 $(".custom-layout .mobile_gallery ol").addClass(ol_classes); 12 } else { 13 $(".custom-layout .mobile_gallery .woocommerce-product-gallery").removeClass(classes); 14 $(".custom-layout .mobile_gallery .flex-control-thumbs").removeClass(ol_classes); 15 } 16 }); 17 18 $(window).on( 'load', function() { 19 if ($(window).width() >= 1025) { 20 $(".custom-layout .mobile_gallery .woocommerce-product-gallery").removeClass(classes); 21 $(".custom-layout .mobile_gallery .flex-control-thumbs").removeClass(ol_classes); 22 } 23 }); 24 25 // Fresco Lightbox 26 if ( getbowtied_scripts_vars.product_lightbox == 1 ) { 27 28 // Add fresco to default gallery 29 $( ".product_layout_classic .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image" ).each(function() { 30 31 $(this).attr('id', 'product-gallery'); 32 $(this).find('a').addClass('fresco'); 33 $(this).find('.fresco').attr('data-fresco-group', $(this).attr('id')); 34 $(this).find('.fresco').attr('data-fresco-group-options', "overflow: true, thumbnails: 'vertical', onClick: 'close'"); 35 $(this).find('.fresco img').addClass('fresco-img'); 36 37 if( ! $(this).find('.fresco').hasClass('video') ) { 38 if ( $(this).find('.fresco img').attr('data-caption').length > 0 ) { 39 $(this).find('.fresco').attr('data-fresco-caption', $(this).find('.fresco img').attr('data-caption')); 40 } 41 } 42 }); 43 44 // Add fresco to mobile gallery 45 $( ".woocommerce-product-gallery__wrapper.mobile-gallery .woocommerce-product-gallery__image" ).each(function() { 46 47 $(this).attr('id', 'product-mobile-gallery'); 48 $(this).find('a').addClass('fresco'); 49 $(this).find('.fresco').attr('data-fresco-group', $(this).attr('id')); 50 $(this).find('.fresco').attr('data-fresco-group-options', "overflow: true, thumbnails: 'horizontal', onClick: 'close'"); 51 $(this).find('.fresco img').addClass('fresco-img'); 52 53 $(this).find('.fresco').each( function() { 54 if( $(this).find('img').length > 0 ) { 55 $(this).attr('data-fresco-options', "thumbnail: '" + $(this).find('img').attr('src') + "'"); 56 } 57 }); 58 59 if ( getbowtied_scripts_vars.product_gallery_zoom ) { 60 $(this).find('.fresco').addClass('zoom'); 61 } 62 63 if( ! $(this).find('.fresco').hasClass('video') ) { 64 if ( $(this).find('.fresco img').attr('data-caption').length > 0 ) { 65 $(this).find('.fresco').attr('data-fresco-caption', $(this).find('.fresco img').attr('data-caption')); 66 } 67 } 68 }); 69 70 // Trigger fresco lightbox 71 $('.product_layout_classic, .custom-layout').on('click', '.fresco-img, .zoomImg', function(){ 72 if ($(window).width() >= 1025) { 73 $(this).siblings('.fresco').trigger('click'); 74 } 75 }); 76 77 $('.custom-layout .easyzoom').on('click', '.easyzoom-flyout', function(){ 78 if ($(window).width() >= 1025) { 79 $(this).siblings('.fresco.zoom').trigger('click'); 80 } 81 }); 82 83 } 84 85 // Default Gallery - Scroll thumbnails 86 $(document).on('click touchend', '.product_layout_classic ol.flex-control-thumbs li img', function() { 87 if ($(window).width() >= 1025) { 88 89 var product_thumbnails = $('ol.flex-control-thumbs'); 90 var product_thumbnails_cells = product_thumbnails.find('li'); 91 var product_thumbnails_height = product_thumbnails.height(); 92 var product_thumbnails_cells_height = product_thumbnails_cells.length ? product_thumbnails_cells.outerHeight() : 0; 93 var product_images = $('.woocommerce-product-gallery__wrapper'); 94 var index = $('.woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image.flex-active-slide').index(); 95 96 var scrollY = (index * product_thumbnails_cells_height) - ( (product_thumbnails_height - product_thumbnails_cells_height) / 2) - 10; 97 98 product_thumbnails.animate({ 99 scrollTop: scrollY 100 }, 300); 101 } 102 }); 103});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.