PageSourceSearch

https://wigetworks.com/wp-content/themes/wigetworks/assets/js/main.js?ver=1667607752

js wigetworks.com collected 2026-10-02 10:03:01 UTC 15,776 bytes, 521 lines download raw bytes

1jQuery(function ($) {
2    // INITIALIZE AOS with options
3    AOS.init({
4        duration: 2000,
5        once: false
6    });
7
8    // Function to throttle the number of calls to AOS.refresh
9    function throttle(func, limit) {
10        let inThrottle;
11        return function () {
12            const args = arguments;
13            const context = this;
14            if (!inThrottle) {
15                func.apply(context, args);
16                inThrottle = true;
17                setTimeout(() => inThrottle = false, limit);
18            }
19        };
20    }
21
22    // Throttled AOS refresh function to be called on scroll
23    const throttledRefresh = throttle(() => {
24        AOS.refresh();
25    }, 50); // Adjust the limit (in milliseconds) as needed
26
27    // Add resize and scroll event listeners
28    window.addEventListener('resize', throttledRefresh);
29    window.addEventListener('scroll', throttledRefresh);
30
31    // COUNTER
32    const $counters = $('.counter');
33
34    if ($counters) {
35        $counters.countUp();
36    }
37
38    // Initialize Fancybox
39    // Fancybox.bind('[data-fancybox]', {});
40
41    // Function to toggle mobile nav
42    const toggleMobileNav = () => {
43        const body = $('body');
44        const header = $('.header');
45        const headerToggle = header.find('.header__toggle');
46
47        headerToggle.on('click', () => {
48            body.toggleClass('overflow-hidden');
49            header.toggleClass('navbar-mobile--show');
50        });
51    };
52    toggleMobileNav();
53
54    // Auto adjust textarea height
55    $('textarea').on('input', function () {
56        this.style.height = 'auto';
57        this.style.height = `${this.scrollHeight}px`;
58    });
59
60    // Ensure accordion button links work
61    $(".accordion-button a").on('click', function () {
62        window.location.href = $(this).attr('href');
63    });
64
65    // SWIPER
66    function initializeSwiper(sectionSelector, swiperOptions) {
67        const sections = document.querySelectorAll(sectionSelector);
68        sections.forEach(function (section) {
69            new Swiper(section.querySelector('.swiper-container'), swiperOptions(section));
70        });
71    }
72
73    // Function to initialize paired sliders and sync them
74    function initializePairedSliders(thumbSelector, contentSelector, thumbOptions, contentOptions) {
75        const thumbSlider = new Swiper(thumbSelector, thumbOptions);
76        const contentSlider = new Swiper(contentSelector, {
77            ...contentOptions,
78            thumbs: {swiper: thumbSlider}
79        });
80
81        contentSlider.on('slideChangeTransitionStart', () => {
82            thumbSlider.slideTo(contentSlider.activeIndex);
83        });
84
85        thumbSlider.on('transitionStart', () => {
86            contentSlider.slideTo(thumbSlider.activeIndex);
87        });
88    }
89
90    initializeSwiper('.section-banner-slider', (section) => ({
91        speed: 500,
92        navigation: {
93            prevEl: section.querySelector('.swiper-prev'),
94            nextEl: section.querySelector('.swiper-next')
95        },
96        pagination: {
97            el: section.querySelector('.swiper-pagination'),
98            clickable: true,
99        }
100    }));
101
102    initializeSwiper('.section-logo-slider', (section) => ({
103        slidesPerView: 3,
104        spaceBetween: 30,
105        breakpoints: {
106            576: {
107                slidesPerView: 5,
108                spaceBetween: 50
109            },
110            992: {
111                slidesPerView: 6,
112                spaceBetween: 100
113            }
114        },
115        speed: 3000,
116        loop: true,
117        autoplay: {
118            delay: 0,
119            disableOnInteraction: false,
120        }
121    }));
122
123    initializeSwiper('.section-home-news', (section) => ({
124        slidesPerView: 1,
125        spaceBetween: 20,
126        breakpoints: {
127            576: {
128                slidesPerView: 2,
129                spaceBetween: 25
130            },
131            992: {
132                slidesPerView: 2,
133                spaceBetween: 30
134            }
135        },
136        speed: 500,
137        pagination: {
138            el: section.querySelector('.swiper-pagination'),
139            clickable: true,
140        }
141    }));
142
143    initializeSwiper('.section-home-events', (section) => ({
144        slidesPerView: 1,
145        spaceBetween: 20,
146        breakpoints: {
147            576: {
148                slidesPerView: 2,
149                spaceBetween: 25
150            },
151            992: {
152                slidesPerView: 3,
153                spaceBetween: 30
154            }
155        },
156        speed: 500,
157        pagination: {
158            el: section.querySelector('.swiper-pagination'),
159            clickable: true,
160        }
161    }));
162
163    initializeSwiper('.section-team', (section) => ({
164        slidesPerView: 2,
165        spaceBetween: 20,
166        breakpoints: {
167            576: {
168                slidesPerView: 3,
169                spaceBetween: 25
170            },
171            992: {
172                slidesPerView: 5,
173                spaceBetween: 30
174            }
175        },
176        speed: 500,
177        pagination: {
178            el: section.querySelector('.swiper-pagination'),
179            clickable: true,
180        }
181    }));
182
183    initializeSwiper('.section-solution-banner', (section) => ({
184        slidesPerView: 1,
185        spaceBetween: 20,
186        breakpoints: {
187            992: {
188                slidesPerView: 2,
189                spaceBetween: 25
190            }
191        },
192        speed: 500,
193        navigation: {
194            prevEl: section.querySelector('.swiper-prev'),
195            nextEl: section.querySelector('.swiper-next')
196        },
197    }));
198
199    // Initialize paired sliders and sync them
200    initializePairedSliders(
201        '.year-thumb .swiper-container', '.year-content .swiper-container',
202        {
203            spaceBetween: 50,
204            slidesPerView: 3,
205            freeMode: true,
206            centeredSlides: true,
207            watchSlidesVisibility: true,
208            watchSlidesProgress: true,
209            slideToClickedSlide: true,
210            breakpoints: {
211                576: {slidesPerView: 4, spaceBetween: 100},
212                992: {slidesPerView: 5, spaceBetween: 200}
213            },
214            speed: 500,
215            navigation: {
216                nextEl: '.year-thumb .swiper-next',
217                prevEl: '.year-thumb .swiper-prev'
218            }
219        },
220        {
221            speed: 500
222        }
223    );
224
225    initializePairedSliders(
226        '.offer-thumb .swiper-container', '.offer-content .swiper-container',
227        {
228            spaceBetween: 20,
229            slidesPerView: 2,
230            freeMode: true,
231            watchSlidesVisibility: true,
232            watchSlidesProgress: true,
233            slideToClickedSlide: true,
234            breakpoints: {
235                576: {slidesPerView: 4, spaceBetween: 25},
236                992: {slidesPerView: 6, spaceBetween: 25}
237            },
238            speed: 500,
239            navigation: {
240                nextEl: '.offer-thumb .swiper-next',
241                prevEl: '.offer-thumb .swiper-prev'
242            }
243        },
244        {
245            speed: 500
246        }
247    );
248
249    initializePairedSliders(
250        '.case-thumb .swiper-container', '.case-content > .swiper-container',
251        {
252            spaceBetween: 40,
253            slidesPerView: 'auto',
254            freeMode: true,
255            watchSlidesVisibility: true,
256            watchSlidesProgress: true,
257            slideToClickedSlide: true,
258            breakpoints: {
259                576: {
260                    spaceBetween: 60
261                },
262                992: {
263                    spaceBetween: 75
264                }
265            },
266            speed: 500,
267            navigation: {
268                nextEl: '.case-thumb .swiper-next',
269                prevEl: '.case-thumb .swiper-prev'
270            }
271        },
272        {
273            speed: 500
274        }
275    );
276
277    initializeSwiper('.section-case-studies .case-studies-slider', (section) => ({
278        slidesPerView: 1,
279        spaceBetween: 20,
280        breakpoints: {
281            576: {
282                slidesPerView: 2,
283                spaceBetween: 25
284            },
285            992: {
286                slidesPerView: 3,
287                spaceBetween: 30
288            }
289        },
290        speed: 500,
291        pagination: {
292            el: section.querySelector('.swiper-pagination'),
293            clickable: true,
294        }
295    }));
296
297    initializeSwiper('.section-features', (section) => ({
298        slidesPerView: 1,
299        spaceBetween: 20,
300        breakpoints: {
301            576: {
302                slidesPerView: 2,
303                spaceBetween: 25
304            },
305            992: {
306                slidesPerView: 4,
307                spaceBetween: 30
308            }
309        },
310        speed: 500,
311        pagination: {
312            el: section.querySelector('.swiper-pagination'),
313            clickable: true,
314        }
315    }));
316
317    initializeSwiper('.section-testimonials', (section) => ({
318        effect: "coverflow",
319        grabCursor: true,
320        slidesPerView: 1,
321        breakpoints: {
322            576: {
323                slidesPerView: 2.8,
324                spaceBetween: 25
325            }
326        },
327        speed: 500,
328        initialSlide: 1,
329        centeredSlides: true,
330        coverflowEffect: {
331            rotate: 0,
332            stretch: -65,
333            depth: 200,
334            modifier: 1,
335            slideShadows: false,
336        },
337        pagination: {
338            el: section.querySelector('.swiper-pagination'),
339            clickable: true,
340        }
341    }));
342
343    // New Code
344
345    initializeSwiper('.section-wherethesky', (section) => ({
346        loop: true,
347        slidesPerView: 3.5,
348        spaceBetween: 20,
349        autoHeight: true,
350        breakpoints: {
351            0: {
352                slidesPerView: 1.5,
353            },
354            992: {
355                slidesPerView: 3.5,
356            }
357        },
358        speed: 500,
359        navigation: {
360            nextEl: '.swiper-next',
361            prevEl: '.swiper-prev'
362        },
363    }));
364
365    initializeSwiper('.airfish-gallery', (section) => ({
366        loop: true,
367        slidesPerView: 1,
368        // centeredSlides: true,
369        spaceBetween: 40,
370        speed: 500,
371        pagination: {
372            el: '.swiper-pagination',
373            clickable: true,
374            renderBullet: function (index, className) {
375                const imageSrc = section.querySelectorAll('.swiper-slide')[index].querySelector('img').src;
376                return `<span class="${className}" style="background-image: url('${imageSrc}');"></span>`;
377            },
378        },
379        navigation: {
380            nextEl: '.swiper-next',
381            prevEl: '.swiper-prev'
382        },
383        touchEventsTarget: 'container',
384        touchRatio: 0,            
385        simulateTouch: false 
386    }));
387    
388
389    $('.open-menu').click(function () { 
390        $('.menu-fixed').fadeIn()
391    });
392    $('.close-menu').click(function () { 
393        $('.menu-fixed').fadeOut()
394    });
395    
396    $('.close').click(function(){
397        $(this).parent().fadeOut();
398        $('.overplay').fadeOut();
399    });
400      
401});
402
403// Animation Customize GSAP
404
405gsap.registerPlugin(ScrollTrigger);
406
407const contents = gsap.utils.toArray('.each_content');
408const airplaneIcons = gsap.utils.toArray('.icon-airplane');
409
410contents.forEach((content, i) => {
411    const airplaneIcon = airplaneIcons[i];
412    
413    ScrollTrigger.create({
414        trigger: '.section-about-airplane',
415        start: () => `${i * window.innerHeight*0.8}px top`,
416        end: () => `+=${window.innerHeight*0.8}px`,
417        onEnter: () => {
418            gsap.to([content, airplaneIcon], { display: 'block', autoAlpha: 1, duration: 0.8 });
419            if (i > 0) {
420                gsap.to([contents[i - 1], airplaneIcons[i - 1]], { autoAlpha: 0, duration: 0.8, onComplete: () => {
421                    gsap.set([contents[i - 1], airplaneIcons[i - 1]], { autoAlpha: 0, duration: 0.8 });
422                }});
423            }
424        },
425        onLeave: () => {
426            gsap.to([content, airplaneIcon], { autoAlpha: 0, duration: 0.5, onComplete: () => {
427                gsap.set([content, airplaneIcon], { autoAlpha: 0, duration: 0.5 });
428            }});
429        },
430        onLeaveBack: () => {
431            gsap.to([content, airplaneIcon], { autoAlpha: 0, duration: 0.5, onComplete: () => {
432                gsap.set([content, airplaneIcon], { autoAlpha: 0, duration: 0.5 });
433            }});
434            if (i > 0) {
435                gsap.set([contents[i - 1], airplaneIcons[i - 1]], { autoAlpha: 1, duration: 0.5 });
436                gsap.to([contents[i - 1], airplaneIcons[i - 1]], { autoAlpha: 1, duration: 0.5 });
437            }
438        },
439        scrub: true,
440    });
441});
442
443
444// OLD Animation With SVG
445
446// gsap.registerPlugin(ScrollTrigger);
447
448// const contents = gsap.utils.toArray('.each_content');
449
450// contents.forEach((content, i) => {
451//     ScrollTrigger.create({
452//         trigger: '.section-about-airplane',
453//         start: () => `${i * window.innerHeight}px top`,
454//         end: () => `+=${window.innerHeight}px`,
455//         onEnter: () => {
456//             gsap.set(content, { display: 'block', autoAlpha: 1 });
457//             if (i > 0) {
458//                 gsap.to(contents[i - 1], { autoAlpha: 0, duration: 0.3, onComplete: () => {
459//                     gsap.set(contents[i - 1], { display: 'none' });
460//                 }});
461//             }
462//             // Hiện icon khi vào section
463//             gsap.to(".icon-airplane", { autoAlpha: 1, duration: 0.5 });
464//         },
465//         onLeave: () => {
466//             gsap.to(content, { autoAlpha: 0, duration: 0.3, onComplete: () => {
467//                 gsap.set(content, { display: 'none' });
468//             }});
469//             // Ẩn icon khi ra khỏi section
470//             gsap.to(".icon-airplane", { autoAlpha: 0, duration: 0.5 });
471//         },
472//         onLeaveBack: () => {
473//             gsap.to(content, { autoAlpha: 0, duration: 0.3, onComplete: () => {
474//                 gsap.set(content, { display: 'none' });
475//             }});
476//             if (i > 0) {
477//                 gsap.set(contents[i - 1], { display: 'block' });
478//                 gsap.to(contents[i - 1], { autoAlpha: 1, duration: 0.3 });
479//             }
480//             // Hiện icon khi cuộn ngược lại
481//             const sectionRect = document.querySelector('.section-about-airplane').getBoundingClientRect();
482//             if (sectionRect.top <= window.innerHeight && sectionRect.bottom >= 0) {
483//                 gsap.to(".icon-airplane", { autoAlpha: 1, duration: 0.5 });
484//             } else {
485//                 gsap.to(".icon-airplane", { autoAlpha: 0, duration: 0.5 });
486//             }
487//         },
488//         scrub: true,
489//         // markers: true // Hiện thị các marker để dễ kiểm tra
490//     });
491// });
492
493// For SVG
494
495// const lines = gsap.utils.toArray('.svg-group path');
496
497// Lấy chiều cao của section
498// const sectionHeight = document.querySelector('.section-about-airplane').offsetHeight;
499
500// lines.forEach((line, i) => {
501//     const length = line.getTotalLength();
502//     line.style.strokeDasharray = length;
503//     line.style.strokeDashoffset = length;
504
505//     ScrollTrigger.create({
506//         trigger: '.section-about-airplane',
507//         start: () => `${(i * sectionHeight) / lines.length}px top`, // Tính start dựa trên chiều cao section
508//         end: () => `+=${sectionHeight}px`, // Kết thúc tại chiều cao của section
509//         scrub: true,
510//         onEnter: () => {
511//             gsap.to(line.style, { strokeDashoffset: 0, duration: 1 });
512//         },
513//         onLeaveBack: () => {
514//             gsap.to(line.style, { strokeDashoffset: length, duration: 1 });
515//         }
516//     });
517// });
518
519// Ẩn icon ban đầu
520// gsap.set(".icon-airplane", { autoAlpha: 0 });
521

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.