/* * Module created by ICC Digital : https://www.icc-digital.fr * * @author ICC Digital * @copyright 2020 ICC Digital */ galleryProductInit(); $('.product-images .slick-current li').addClass('active'); /*setTimeout(function () { $('#taille-selected').click(); }, 3000);*/ $(document).on('mouseover', '.product-images li', function () { $('.product-images li').removeClass('active'); $('.product-cover img').attr('src', $('img', this).attr('data-src')); $(this).addClass('active'); }); $(document).on('click', '.product-cover img', function (e) { e.preventDefault(); $('.product-images .slick-slide:not(.slick-cloned) a[data-id-img*="' + $(this).attr('data-id-img') + '"]').trigger('click'); }); prestashop.on('updatedProduct', (data) => { $('select').select2({ minimumResultsForSearch: 13, width: '100%' }); galleryProductInit(); }); //Show full desc $('#show-desc').click((e) => { $('#product-description-short').toggleClass('full-desc'); }); //Toggle produit en barre de droite $(document).on('click', '.section-toggle .title', (event) => { $('.section-toggle .title').removeClass('active'); $(event.currentTarget).toggleClass('active').parent().find('.content').stop(true).slideToggle(); }); // Button quantity page product ... let $inputNumber = $('#quantity_wanted'); if ($inputNumber.length) { $('.button-quantity').click(function (event) { event.preventDefault(); let val = $inputNumber.val(); let number = parseInt(val); if ($(this).data('operator') === 'minus') { if (number - 1 < $inputNumber.attr('min')) return; $inputNumber.val(number - 1) } else if ($(this).data('operator') === 'plus') { $inputNumber.val(number + 1) } }); } function galleryProductInit() { $('.product-images').slick({ slidesToShow: 1, slidesToScroll: 1, responsive: [ { breakpoint: 992, settings: { slidesToShow: 4, } }, { breakpoint: 992, settings: { infinite: false, arrows: true, vertical: false, slidesToShow: 1, slidesToScroll: 1, dots: true } }] }); $('.slick-slide:not(.slick-cloned) [data-fancybox="images"]').fancybox({ hash: false, hideScrollbar: true, loop: true, thumbs: { autoStart: false, // Display thumbnails on opening hideOnClose: true, // Hide thumbnail grid when closing animation starts parentEl: ".fancybox-container", // Container is injected into this element axis: "y" // Vertical (y) or horizontal (x) scrolling }, }); }