PageSourceSearch

https://kirah.com/wp-content/themes/herrington/elements/widgets/js/carousel.js?ver=1.1.0

js kirah.com collected 2026-10-09 23:35:19 UTC 17,377 bytes, 406 lines download raw bytes

1( function( $ ) {
2        "use strict";
3
4    function herrington_svg_color2($scope) {
5        jQuery($scope).find('.pxl-swiper-slider .pxl-post--icon img').each(function () {
6            var $img = jQuery(this);
7            var imgID = $img.attr('id');
8            var imgClass = $img.attr('class');
9            var imgURL = $img.attr('src');
10
11            jQuery.get(imgURL, function (data) {
12                var $svg = jQuery(data).find('svg');
13                if (imgID) {
14                    $svg.attr('id', imgID);
15                }
16                if (imgClass) {
17                    $svg.attr('class', imgClass + ' replaced-svg');
18                }
19                $svg.removeAttr('xmlns:a');
20                if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
21                    $svg.attr('viewBox', '0 0 24 24');
22                }
23                $img.replaceWith($svg);
24            }, 'xml');
25        });
26    }
27
28    function pxl_swiper_handler($scope){
29        $scope.find('.pxl-swiper-slider').each(function(index, element) {
30            var $this = $(this);
31            
32            var settings = $this.find(".pxl-swiper-container").data().settings;
33            var numberOfSlides = $this.find(".pxl-swiper-slide").length;
34            var carousel_settings = {
35                direction: settings['slide_direction'],
36                effect: settings['slide_mode'],
37                wrapperClass : 'pxl-swiper-wrapper',
38                slideClass: 'pxl-swiper-slide',
39                slidesPerView: settings['slides_to_show'],
40                slidesPerGroup: settings['slides_to_scroll'],
41                slidesPerColumn: settings['slide_percolumn'],
42                allowTouchMove:  settings['allow_touch_move'] !== undefined ? settings['allow_touch_move']:true,
43                spaceBetween: 0,
44                observer: true,
45                observeParents: true,
46                navigation: {
47                    nextEl: $this.find('.pxl-swiper-arrow-next')[0],
48                    prevEl: $this.find('.pxl-swiper-arrow-prev')[0],
49                },
50                pagination : {
51                    type: settings['pagination_type'],
52                    el: $this.find('.pxl-swiper-dots')[0],
53                    clickable : true,
54                    modifierClass: 'pxl-swiper-pagination-',
55                    bulletClass : 'pxl-swiper-pagination-bullet',
56                    renderCustom: function (swiper, element, current, total) {
57                        return current + ' of ' + total;
58                    }
59                },
60                speed: settings['speed'],
61                watchSlidesProgress: true,
62                watchSlidesVisibility: true,
63                breakpoints: {
64                    0 : {
65                        slidesPerView: settings['slides_to_show_xs'],
66                        slidesPerGroup: settings['slides_to_scroll'],
67                    },
68                    576 : {
69                        slidesPerView: settings['slides_to_show_sm'],
70                        slidesPerGroup: settings['slides_to_scroll'],
71                    },
72                    768 : {
73                        slidesPerView: settings['slides_to_show_md'],
74                        slidesPerGroup: settings['slides_to_scroll'],
75                    },
76                    992 : {
77                        slidesPerView: settings['slides_to_show_lg'],
78                        slidesPerGroup: settings['slides_to_scroll'],
79                    },
80                    1200 : {
81                        slidesPerView: settings['slides_to_show'],
82                        slidesPerGroup: settings['slides_to_scroll'],
83                    },
84                    1400 : {
85                        slidesPerView: settings['slides_to_show_xxl'],
86                        slidesPerGroup: settings['slides_to_scroll'],
87                    }
88                },
89                on: {
90                    slideChangeTransitionStart : function (swiper){
91                        var activeIndex = this.activeIndex;
92                        $(this.slides).each(function(index){
93                            if(index == activeIndex)
94                                $(this).find('.wow').removeClass('pxl-invisible').addClass('animated');
95                            else
96                                $(this).find('.wow').removeClass('animated').addClass('pxl-invisible');
97                        });
98                        
99                    },
100
101                    slideChange: function (swiper) { 
102
103                        var activeIndex = this.activeIndex; 
104                        $(this.slides).each(function(index){
105                            if(index == activeIndex)
106                                $(this).find('.wow').removeClass('pxl-invisible').addClass('animated');
107                            else
108                                $(this).find('.wow').removeClass('animated').addClass('pxl-invisible');
109                        });
110
111                    },
112
113                    sliderMove: function (swiper) { 
114
115                        var activeIndex = this.activeIndex; 
116                        $(this.slides).each(function(index){
117                            if(index == activeIndex)
118                                $(this).find('.wow').removeClass('pxl-invisible').addClass('animated');
119                            else
120                                $(this).find('.wow').removeClass('animated').addClass('pxl-invisible');
121                        });
122
123                    },
124
125                }
126            };
127
128
129            // if ($('.pxl-slider-carousel1').length > 0) {
130            //     carousel_settings.allowTouchMove = true;
131            // }
132
133
134            if(settings['center_slide'] || settings['center_slide'] === 'true'){
135                if(settings['loop'] || settings['loop'] === 'true'){
136                    carousel_settings['initialSlide'] = Math.floor(numberOfSlides / 2);
137                } else {
138                    if(carousel_settings['slidesPerView'] > 1){  
139                        carousel_settings['initialSlide'] = Math.floor((numberOfSlides - carousel_settings['slidesPerView']) / 2);
140                    } else {
141                        carousel_settings['initialSlide'] = Math.ceil((numberOfSlides / 2) - 1);
142                    }
143                }
144                
145               // carousel_settings['initialSlide']  = 3;
146            }
147
148            
149            if(settings['center_slide'] || settings['center_slide'] == 'true')
150                carousel_settings['centeredSlides'] = true;
151
152            if(settings['loop'] || settings['loop'] === 'true'){
153                carousel_settings['loop'] = true;
154            }
155
156            if(settings['autoplay'] || settings['autoplay'] === 'true'){
157                carousel_settings['autoplay'] = {
158                    delay : settings['delay'],
159                    disableOnInteraction : settings['pause_on_interaction']
160                };
161            } else {
162                carousel_settings['autoplay'] = false;
163            }
164            
165            // parallax
166            if(settings['parallax'] === 'true'){
167                carousel_settings['parallax'] = true;
168            }
169
170            if(settings['slide_mode'] === 'fade'){
171                carousel_settings['fadeEffect'] = {
172                    crossFade: true
173                };
174            }
175            
176            // Creative Effect
177            if(settings['creative-effect'] === 'effect1'){
178                carousel_settings['creativeEffect'] = {
179                    prev: {
180                        opacity: 0,
181                    },
182                    next: {
183                        opacity: 0,
184                    },
185                };
186            }
187
188            // Start Swiper Thumbnail
189            if($this.find('.pxl-swiper-thumbs').length > 0) {
190
191                var thumb_settings = $this.find('.pxl-swiper-thumbs').data().settings;
192
193                var thumb_carousel_settings = {
194                    effect: 'slide',
195                    direction: 'horizontal',
196                    spaceBetween: 0,
197                    slidesPerView: '4',
198                    centeredSlides: false,
199                    loop: false,  
200                    watchSlidesProgress: true,
201                    slideToClickedSlide: true,
202                };
203
204                var slide_thumbs = new Swiper($this.find('.pxl-swiper-thumbs')[0], thumb_carousel_settings);
205                carousel_settings['thumbs'] = { swiper: slide_thumbs };
206            }
207
208            var allSlides = $this.find(".pxl-swiper-slide");
209            // End Swiper Thumbnail
210           /* $this.find(".pxl-swiper-slide").remove();
211            allSlides.each(function(e){ 
212                 $this.find('.pxl-swiper-wrapper').append($(this)[0].outerHTML);
213                
214            });*/
215
216            var swiper = new Swiper($this.find(".pxl-swiper-container")[0], carousel_settings);
217
218            if(settings['autoplay'] === true && settings['pause_on_hover'] === true){
219                $( $this.find('.pxl-swiper-container') ).on({
220                    mouseenter: function mouseenter() {
221                        this.swiper.autoplay.stop();
222                    },
223                    mouseleave: function mouseleave() {
224                        this.swiper.autoplay.start();
225                    }
226                });
227            }
228
229            // Scroll Section Slip
230            $(window).scroll(function() {
231                let pxl_window_height = $(window).innerHeight();
232
233                let slides = swiper.slides;
234                let hPerc = Math.round(100 / slides.length);
235
236                if($('.pxl-testimonial-slip-wrapper').length > 0) {
237                    let offset = $('.pxl-testimonial-slip-wrapper')[0].getBoundingClientRect();
238                    if (offset.top < 0 && offset.bottom - pxl_window_height > 0) {
239                        let perc = Math.round(100 * Math.abs(offset.top) / (offset.height - $(window).height()));
240                        if (hPerc > 19) {
241                            for (var i = 0; i < slides.length; i++) {
242                                if (perc > (hPerc * i) && perc < (hPerc * (i + 1))) {
243                                    swiper.slideTo(i, 300);
244                                }
245                            }
246                        }
247                    }
248                } 
249            });
250
251            // Navigation-Carousel
252            $('.pxl-navigation-carousel').parents('.elementor-section').addClass('pxl--hide-arrow');
253            setTimeout(function() {
254                $('.pxl-navigation-carousel .pxl-navigation-arrow-prev').on('click', function () {
255                    $(this).parents('.elementor-section').find('.pxl-swiper-arrow.pxl-swiper-arrow-prev').trigger('click');
256                });
257                $('.pxl-navigation-carousel .pxl-navigation-arrow-next').on('click', function () {
258                    $(this).parents('.elementor-section').find('.pxl-swiper-arrow.pxl-swiper-arrow-next').trigger('click');
259                });
260            }, 300);
261
262            
263
264
265            $scope.find(".pxl--filter-inner .filter-item").on("click", function(){
266                var target = $(this).attr('data-filter-target');
267                var $parent = $(this).closest('.pxl-swiper-slider');
268                $(this).siblings().removeClass("active");
269                $(this).addClass("active");
270                $parent.find(".pxl-swiper-slide").remove();
271                if(target == "all"){
272                    allSlides.each(function(){
273                        $this.find('.pxl-swiper-wrapper').append($(this)[0].outerHTML);
274                    });
275                }else{
276                    allSlides.each(function(){
277                        if( $(this).is("[data-filter^='"+target+"']") || $(this).is("[data-filter*='"+target+"']")  ) { 
278                            $this.find('.pxl-swiper-wrapper').append($(this)[0].outerHTML);
279                        }
280                    });
281                }
282                numberOfSlides = $parent.find(".pxl-swiper-slide").length;     
283                if(carousel_settings['centeredSlides'] ){
284                    if( carousel_settings['loop'] ){
285                        carousel_settings['initialSlide'] = Math.floor(numberOfSlides / 2);
286                    } else {
287                        if( carousel_settings['slidesPerView'] > 1){  
288                            carousel_settings['initialSlide'] = Math.ceil((numberOfSlides - carousel_settings['slidesPerView']) / 2);
289                        } else {
290                            carousel_settings['initialSlide'] = Math.ceil((numberOfSlides / 2) - 1);
291                        }
292                    }
293
294                }
295                swiper.destroy();
296                swiper = new Swiper($parent.find(".pxl-swiper-container")[0], carousel_settings);
297
298
299                $('.pxl-portfolio-carousel2 .pxl-swiper-slide .pxl-post--inner').each(function(){
300                 var bg = $(this).css('background-image');
301                 bg = bg.replace('url(','').replace(')','').replace(/\"/gi, "");
302                 $('.bgr-change').css('background-image', 'url(' + bg + ')');
303                 $(this).hover(function(){
304                    var bg = $(this).css('background-image');
305                    bg = bg.replace('url(','').replace(')','').replace(/\"/gi, "");
306                    $('.bgr-change').css('background-image', 'url(' + bg + ')');
307                    $('.bgr-change').addClass('flicker')
308                    setTimeout(() => {
309                        $('.bgr-change').removeClass('flicker')
310                    }, 600)
311                });
312             });
313            });
314        });  
315        jQuery($scope).find('.pxl-swiper-slider .pxl-post--icon img').each(function () {
316            var $img = jQuery(this);
317            var imgID = $img.attr('id');
318            var imgClass = $img.attr('class');
319            var imgURL = $img.attr('src');
320
321            jQuery.get(imgURL, function (data) {
322                var $svg = jQuery(data).find('svg');
323                if (imgID) {
324                    $svg.attr('id', imgID);
325                }
326                if (imgClass) {
327                    $svg.attr('class', imgClass + ' replaced-svg');
328                }
329                $svg.removeAttr('xmlns:a');
330                if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
331                    $svg.attr('viewBox', '0 0 24 24');
332                }
333                $img.replaceWith($svg);
334            }, 'xml');
335        });
336function findCenteredSlides( swiper, $parent  ) {
337    var slides = $parent.find( '.swiper-slide-visible' ),
338    elOffsetLeft  = $( swiper.$el ).offset().left,
339    elOffsetRight = elOffsetLeft + $( swiper.$el ).outerWidth();
340    slides.each( function() {
341        if ($(this).hasClass('swiper-slide-visible')) {
342            var thisSlideOffsetLeft  = $( this ).offset().left - 1,
343            thisSlideOffsetRight = $( this ).offset().left + 1 + $( this ).outerWidth();
344
345            if ( thisSlideOffsetLeft > elOffsetLeft && thisSlideOffsetRight < elOffsetRight ) {
346                $( this ).addClass( 'swiper-slide-active' ).removeClass( 'swiper-slide-uncentered' );
347            } else {
348                $( this ).removeClass( 'swiper-slide-active' ).addClass( 'swiper-slide-uncentered' );
349            } 
350        }
351    } );
352}
353
354};
355
356$( window ).on( 'elementor/frontend/init', function() {
357
358    elementorFrontend.hooks.addAction( 'frontend/element_ready/global', function( $scope ) {
359        herrington_svg_color2($scope);
360    } );
361
362    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_post_carousel.default', function( $scope ) {
363        pxl_swiper_handler($scope);
364    } );
365    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_slider_carousel.default', function( $scope ) {
366        pxl_swiper_handler($scope);
367    } );
368
369    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_team_carousel.default', function( $scope ) {
370        pxl_swiper_handler($scope);
371    } );
372    
373    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_client_carousel.default', function( $scope ) {
374        pxl_swiper_handler($scope);
375    } );
376
377    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_text_c
377arousel.default', function( $scope ) {
378        pxl_swiper_handler($scope);
379    } );
380
381    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_image_carousel.default', function( $scope ) {
382        pxl_swiper_handler($scope);
383    } );
384
385    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_testimonial_slip.default', function( $scope ) {
386        pxl_swiper_handler($scope);
387    } );
388
389    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_tab_carousel.default', function( $scope ) {
390        pxl_swiper_handler($scope);
391    } );
392
393    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_testimonial_carousel.default', function( $scope ) {
394        pxl_swiper_handler($scope);
395    } );
396
397    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_partner_carousel.default', function( $scope ) {
398        pxl_swiper_handler($scope);
399    } );
400
401    elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_iconbox_carousel.default', function( $scope ) {
402        pxl_swiper_handler($scope);
403    } );
404
405} );
406} )( jQuery );

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.