PageSourceSearch

https://www.accademiamoda.it/wp-content/themes/iuad-theme/src/js/custom/exchange-partner-carousel.js?ver=1.0.0

js accademiamoda.it collected 2026-10-04 13:23:42 UTC 2,944 bytes, 91 lines download raw bytes

1/**
2 * Exchange Partner Carousel - Horizontal Scrollable Carousel
3 * Mostra 3 card complete + un pezzo della successiva
4 * Scrollabile con mouse drag, senza navigazione
5 */
6
7(function() {
8    'use strict';
9
10    document.addEventListener('DOMContentLoaded', function() {
11        // Inizializza il carousel solo se esiste
12        const carouselElement = document.querySelector('.exchange-partner-swiper');
13        
14        if (!carouselElement) return;
15        
16        // Verifica che l'elemento sia visibile (non nascosto da display:none)
17        const isVisible = window.getComputedStyle(carouselElement).display !== 'none';
18        if (!isVisible) {
19            // Se non è visibile, aspetta che diventi visibile (per template responsive dinamici)
20            const checkVisibility = () => {
21                const checkVisible = window.getComputedStyle(carouselElement).display !== 'none';
22                if (checkVisible) {
23                    initExchangePartnerCarousel();
24                } else {
25                    setTimeout(checkVisibility, 100);
26                }
27            };
28            checkVisibility();
29            return;
30        }
31
32        initExchangePartnerCarousel();
33    });
34    
35    function initExchangePartnerCarousel() {
36        const carouselElement = document.querySelector('.exchange-partner-swiper');
37        
38        if (!carouselElement) return;
39        
40        // Verifica nuovamente la visibilità prima di inizializzare
41        if (window.getComputedStyle(carouselElement).display === 'none') {
42            return;
43        }
44
45        // Verifica che Swiper sia disponibile
46        if (typeof Swiper === 'undefined') {
47            console.error('Swiper non è disponibile per exchange-partner-carousel');
48            return;
49        }
50
51        // Inizializza Swiper
52        const exchangePartnerSwiper = new Swiper('.exchange-partner-swiper', {
53            // Auto: mostra tutte le card che ci stanno (larghezza fissa 540px)
54            slidesPerView: 3.3,
55            spaceBetween: 20,
56            
57            // Free mode per scroll fluido
58            freeMode: true,
59            
60            // Grab cursor per indicare drag
61            grabCursor: true,
62            
63            // Velocità di transizione
64            speed: 600,
65            
66            // Mouse wheel per scroll
67            mousewheel: {
68                forceToAxis: true,
69                releaseOnEdges: true,
70            },
71            
72            // Keyboard control
73            keyboard: {
74                enabled: true,
75                onlyInViewport: true,
76            },
77            
78            // Callbacks
79            on: {
80                init: function() {
81                    //console.log('Exchange Partner Carousel initialized');
82                },
83            },
84        });
85
86        // Esponi l'istanza Swiper globalmente se necessario
87        window.exchangePartnerSwiper = exchangePartnerSwiper;
88    }
89
90})();
91

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.