PageSourceSearch

https://redcross.or.ke/wp-content/themes/jackcerra/assets/js/theme.js?ver=1.0.1

js redcross.or.ke collected 2026-10-02 06:16:20 UTC 22,119 bytes, 566 lines download raw bytes

1;(function ($) {
2
3    "use strict";
4    
5    var pxl_scroll_top;
6    var pxl_window_height;
7    var pxl_window_width;
8    var pxl_scroll_status = '';
9    var pxl_last_scroll_top = 0;
10    $(window).on('load', function () {
11        $(".pxl-loader").addClass("is-loaded");
12        $('.pxl-element-slider').css('opacity', '1');
13        $('.pxl-element-slider').css('transition-delay', '300ms');
14        $('.pxl-gallery-scroll').parents('body').addClass('body-overflow').addClass('body-visible-sm');
15        pxl_window_width = $(window).width();
16        pxl_window_height = $(window).height();
17        jackcerra_header_sticky();
18        jackcerra_header_mobile();
19        jackcerra_scroll_to_top();
20        jackcerra_footer_fixed();
21        jackcerra_shop_quantity();
22        jackcerra_submenu_responsive();
23        jackcerra_column_stretch();
24    });
25
26    $(window).on('scroll', function () {
27        pxl_scroll_top = $(window).scrollTop();
28        pxl_window_height = $(window).height();
29        pxl_window_width = $(window).width();
30        if (pxl_scroll_top < pxl_last_scroll_top) {
31            pxl_scroll_status = 'up';
32        } else {
33            pxl_scroll_status = 'down';
34        }
35        pxl_last_scroll_top = pxl_scroll_top;
36        jackcerra_header_sticky();
37        jackcerra_scroll_to_top();
38        jackcerra_footer_fixed();
39    });
40
41    $(window).on('resize', function () {
42        pxl_window_height = $(window).height();
43        pxl_window_width = $(window).width();
44        jackcerra_submenu_responsive();
45        jackcerra_header_mobile();
46        jackcerra_column_stretch();
47    });
48
49    $(document).ready(function () {
50
51        $('.pxl-logo-nav').parents('#pxl-header-elementor').addClass('pxl-header-rmboxshadow');
52
53        /* Start Menu Mobile */
54        $('.pxl-header-menu li.menu-item-has-children').append('<span class="pxl-menu-toggle"></span>');
55        $('.pxl-menu-toggle').on('click', function () {
56            if( $(this).hasClass('active')){
57                $(this).closest('ul').find('.pxl-menu-toggle.active').toggleClass('active');
58                $(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle();    
59            }else{
60                $(this).closest('ul').find('.pxl-menu-toggle.active').toggleClass('active');
61                $(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle();
62                $(this).toggleClass('active');
63                $(this).parent().find('> .sub-menu').toggleClass('active');
64                $(this).parent().find('> .sub-menu').slideToggle();
65            }      
66        });
67    
68        $("#pxl-nav-mobile").on('click', function () {
69            $(this).toggleClass('active');
70            $('body').toggleClass('body-overflow');
71            $('.pxl-header-menu').toggleClass('active');
72        });
73
74        $(".pxl-menu-close, .pxl-header-menu-backdrop, #pxl-header-mobile .pxl-menu-primary a.is-one-page").on('click', function () {
75            $(this).parents('.pxl-header-main').find('.pxl-header-menu').removeClass('active');
76            $('#pxl-nav-mobile').removeClass('active');
77            $('body').toggleClass('body-overflow');
78        });
79        /* End Menu Mobile */
80
81        /* Elementor Header */
82        $('.pxl-type-header-clip > .elementor-container').append('<div class="pxl-header-shape"><span></span></div>');
83
84        /* Scroll To Top */
85        $('.pxl-scroll-top').click(function () {
86            $('html, body').animate({scrollTop: 0}, 800);
87            return false;
88        });
89
90        /* Animate Time Delay */
91        $('.pxl-grid-masonry').each(function () {
92            var eltime = 40;
93            var elt_inner = $(this).children().length;
94            var _elt = elt_inner - 1;
95            $(this).find('> .pxl-grid-item > .wow').each(function (index, obj) {
96                $(this).css('animation-delay', eltime + 'ms');
97                if (_elt === index) {
98                    eltime = 40;
99                    _elt = _elt + elt_inner;
100                } else {
101                    eltime = eltime + 40;
102                }
103            });
104        });
105
106        $('.pxl-item--text').each(function () {
107            var pxl_time = 0;
108            var pxl_item_inner = $(this).children().length;
109            var _elt = pxl_item_inner - 1;
110            $(this).find('> .pxl-text--slide > .wow').each(function (index, obj) {
111                $(this).css('transition-delay', pxl_time + 'ms');
112                if (_elt === index) {
113                    pxl_time = 0;
114                    _elt = _elt + pxl_item_inner;
115                } else {
116                    pxl_time = pxl_time + 80;
117                }
118            });
119        });
120
121        /* Lightbox Popup */
122        $('.btn-video, .pxl-video-popup, .pxl--link-popup').magnificPopup({
123            type: 'iframe',
124            mainClass: 'mfp-fade',
125            removalDelay: 160,
126            preloader: false,
127            fixedContentPos: false
128        });
129
130        $('.images-light-box').each(function () {
131            $(this).magnificPopup({
132                delegate: 'a.light-box',
133                type: 'image',
134                gallery: {
135                    enabled: true
136                },
137                mainClass: 'mfp-fade',
138            });
139        });
140
141        /* Parallax */
142        if($('#pxl-page-title-default').hasClass('pxl--parallax')) {
143            $(this).stellar();
144        }
145
146        /* Animate Time */
147        $('.btn-nina').each(function () {
148            var eltime = 0.045;
149            var elt_inner = $(this).children().length;
150            var _elt = elt_inner - 1;
151            $(this).find('> .pxl--btn-text > span').each(function (index, obj) {
152                $(this).css('transition-delay', eltime + 's');
153                eltime = eltime + 0.045;
154            });
155        });
156
157        /* Search Popup */
158        $(".pxl-search-popup-button").on('click', function () {
159            $('body').addClass('body-overflow');
160            $('#pxl-search-popup').addClass('active');
161            setTimeout(function(){
162                $('#pxl-search-popup .search-field').focus();
163            },1000);
164        });
165        $("#pxl-search-popup .pxl-item--overlay, #pxl-search-popup .pxl-item--close").on('click', function () {
166            $('body').removeClass('body-overflow');
167            $('#pxl-search-popup').removeClass('active');
168        });
169
170        /* Hidden Panel */
171        $(".pxl-hidden-panel-button").on('click', function () {
172            $(this).toggleClass('active');
173            $('body').addClass('body-overflow');
174            $('#pxl-hidden-panel-popup').addClass('active');
175        });
176        $("#pxl-hidden-panel-popup .pxl-item--overlay, #pxl-hidden-panel-popup .pxl-item--close").on('click', function () {
177            $('body').removeClass('body-overflow');
178            $('#pxl-hidden-panel-popup').removeClass('active');
179            $('.pxl-hidden-panel-button').removeClass('active');
180        });
181
182        /* Cart Sidebar Popup */
183        $(".pxl-cart-sidebar-button").on('click', function () {
184            $('body').addClass('body-overflow');
185            $('#pxl-cart-sidebar').addClass('active');
186        });
187        $("#pxl-cart-sidebar .pxl-item--overlay, #pxl-cart-sidebar .pxl-item--close").on('click', function () {
188            $('body').removeClass('body-overflow');
189            $('#pxl-cart-sidebar').removeClass('active');
190        });
191
192        /* Popup */
193        $(".pxl-popup-button").on('click', function () {
194            $('body').addClass('body-overflow');
195            $('#pxl-popup-elementor').addClass('active');
196            $('#pxl-popup-elementor').removeClass('deactivation');
197        });
198        $("#pxl-popup-elementor .pxl-item--overlay, #pxl-popup-elementor .pxl-item--close, .pxl-menu-primary a.is-one-page").on('click', function () {
199            $('body').removeClass('body-overflow');
200            $('#pxl-popup-elementor').removeClass('active');
201            $('#pxl-popup-elementor').addClass('deactivation');
202        });
203
204        /* Hover Active Item */
205        $('.pxl--widget-hover').each(function () {
206            $(this).hover(function () {
207                $(this).parents('.elementor-row').find('.pxl--widget-hover').removeClass('pxl--item-active');
208                $(this).parents('.elementor-container').find('.pxl--widget-hover').removeClass('pxl--item-active');
209                $(this).addClass('pxl--item-active');
210            });
211        });
212
213        /* Hover Button */
214        $('.btn-plus-text').hover(function () {
215            $(this).find('span').toggle(300);
216        });
217
218        /* Nav Logo */
219        $(".pxl-nav-button").on('click', function () {
220            $('.pxl-nav-button').toggleClass('active');
221            $('.pxl-nav-button').parent().find('.pxl-nav-wrap').toggle(400);
222        });
223
224        /* Button Mask */
225        $('.pxl-btn-effect4').append('<span class="pxl-btn-mask"></span>');
226
227        /* Start Icon Bounce */
228        var boxEls = $('.el-bounce, .pxl-image-effect1');
229        $.each(boxEls, function(boxIndex, boxEl) {
230            loopToggleClass(boxEl, 'bounce-active');
231        });
232
233        function loopToggleClass(el, toggleClass) {
234            el = $(el);
235            let counter = 0;
236            if (el.hasClass(toggleClass)) {
237                waitFor(function () {
238                    counter++;
239                    return counter == 2;
240                }, function () {
241                    counter = 0;
242                    el.removeClass(toggleClass);
243                    loopToggleClass(el, toggleClass);
244                }, 'Deactivate', 1000);
245            } else {
246                waitFor(function () {
247                    counter++;
248                    return counter == 3;
249                }, function () {
250                    counter = 0;
251                    el.addClass(toggleClass);
252                    loopToggleClass(el, toggleClass);
253                }, 'Activate', 1000);
254            }
255        }
256
257        function waitFor(condition, callback, message, time) {
258            if (message == null || message == '' || typeof message == 'undefined') {
259                message = 'Timeout';
260            }
261            if (time == null || time == '' || typeof time == 'undefined') {
262                time = 100;
263            }
264            var cond = condition();
265            if (cond) {
266                callback();
267            } else {
268                setTimeout(function() {
269                    waitFor(condition, callback, message, time);
270                }, time);
271            }
272        }
273        /* End Icon Bounce */
274
275        /* Image Effect */
276        if($('.pxl-image-tilt').length){
277            $('.pxl-image-tilt').parents('.elementor-top-section').addClass('pxl-image-tilt-active');
278            $('.pxl-image-tilt').each(function () {
279                var pxl_maxtilt = $(this).data('maxtilt'),
280                    pxl_speedtilt = $(this).data('speedtilt'),
281                    pxl_perspectivetilt = $(this).data('perspectivetilt');
282                VanillaTilt.init(this, {
283                    max: pxl_maxtilt,
284                    speed: pxl_speedtilt,
285                    perspective: pxl_perspectivetilt
286                });
287            });
288        }
289
290        /* Pricing Hover */
291        $('.pxl-pricing1').each(function () {
292            $(this).hover(function () {
293                $(this).parents('.elementor-element').find('.pxl-pricing1').removeClass('is-popular');
294                $(this).addClass('is-popular');
295            });
296        });
297
298        /* Select Theme Style */
299        $('.wpcf7-select').each(function(){
300            var $this = $(this), numberOfOptions = $(this).children('option').length;
301          
302            $this.addClass('pxl-select-hidden'); 
303            $this.wrap('<div class="pxl-select"></div>');
304            $this.after('<div class="pxl-select-higthlight"></div>');
305
306            var $styledSelect = $this.next('div.pxl-select-higthlight');
307            $styledSelect.text($this.children('option').eq(0).text());
308          
309            var $list = $('<ul />', {
310                'class': 'pxl-select-options'
311            }).insertAfter($styledSelect);
312          
313            for (var i = 0; i < numberOfOptions; i++) {
314                $('<li />', {
315                    text: $this.children('option').eq(i).text(),
316                    rel: $this.children('option').eq(i).val()
317                }).appendTo($list);
318            }
319          
320            var $listItems = $list.children('li');
321          
322            $styledSelect.click(function(e) {
323                e.stopPropagation();
324                $('div.pxl-select-higthlight.active').not(this).each(function(){
325                    $(this).removeClass('active').next('ul.pxl-select-options').addClass('pxl-select-lists-hide');
326                });
327                $(this).toggleClass('active');
328            });
329          
330            $listItems.click(function(e) {
331                e.stopPropagation();
332                $styledSelect.text($(this).text()).removeClass('active');
333                $this.val($(this).attr('rel'));
334            });
335          
336            $(document).click(function() {
337                $styledSelect.removeClass('active');
338            });
339
340        });
341
342        /* Nice Select */
343        $('.woocommerce-ordering .orderby, #pxl-sidebar-area select, .variations_form.cart .variations select').each(function () {
344            $(this).niceSelect();
345        });
346
347        /* Item Hover - Description */
348        $( ".pxl-content-effect .pxl-item--inner" ).hover(
349          function() {
350            $( this ).find('.pxl-item--effect').slideToggle(400);
351          }, function() {
352            $( this ).find('.pxl-item--effect').slideToggle(400);
353          }
354        );
355
356        /* Typewriter */
357        if($('.pxl-title--typewriter').length) {
358            function typewriterOut(elements, callback)
359            {
360                if (elements.length){
361                    elements.eq(0).addClass('is-active');
362                    elements.eq(0).delay( 3000 );
363                    elements.eq(0).removeClass('is-active');
364                    typewriterOut(elements.slice(1), callback);
365                }
366                else {
367                    callback();
368                }
369            }
370
371            function typewriterIn(elements, callback)
372            {
373                if (elements.length){
374                    elements.eq(0).addClass('is-active');
375                    elements.eq(0).delay( 3000 ).slideDown(3000, function(){
376                        elements.eq(0).removeClass('is-active');
377                        typewriterIn(elements.slice(1), callback);
378                    });
379                }
380                else {
381                    callback();
382                }
383            }
384
385            function typewriterInfinite(){
386                typewriterOut($('.pxl-title--typewriter .pxl-item--text'), function(){ 
387                    typewriterIn($('.pxl-title--typewriter .pxl-item--text'), function(){
388                        typewriterInfinite();
389                    });
390                });
391            }
392            $(function(){
393                typewriterInfinite();
394            });
395        }
396        /* End Typewriter */
397
398        /* Section Particles */      
399        setTimeout(function() {
400            $(".pxl-row-particles").each(function() {
401                particlesJS($(this).attr('id'), {
402                  "particles": {
403                    "number": {
404                        "value": $(this).data('number'),
405                    },
406                    "color": {
407                        "value": $(this).data('color')
408                    },
409                    "shape": {
410                        "type": "circle",
411                    },
412                    "size": {
413                        "value": $(this).data('size'),
414                        "random": $(this).data('size-random'),
415                    },
416                    "line_linked": {
417                        "enable": false,
418                    },
419                    "move": {
420                        "enable": true,
421                        "speed": 2,
422                        "direction": $(this).data('move-direction'),
423                        "random": true,
424                        "out_mode": "out",
425                    }
426                  },
427                  "retina_detect": true
428                });
429            });
430        }, 400);
431
432        /* Get checked input - Mailchimpp */
433        $('.mc4wp-form input:checkbox').change(function(){
434            if($(this).is(":checked")) {
435                $('.mc4wp-form').addClass("pxl-input-checked");
436            } else {
437                $('.mc4wp-form').removeClass("pxl-input-checked");
438            }
439        });
440
441        /* Alert */
442        $(".pxl-alert .pxl-alert--close").on('click', function () {
443            $(this).parent().fadeOut();
444        });
445
446        /* Widget remove arrow */
447        $('.widget .pxl-count').parent().addClass('pxl-rm-arrow');
448
449        /* Scroll to content */
450        $('.pxl-link-to-section .btn').on('click', function(e) {
451            var id_scroll = $(this).attr('href');
452            var offsetScroll = $('.pxl-header-elementor-sticky').outerHeight();
453            e.preventDefault();
454            $("html, body").animate({ scrollTop: $(id_scroll).offset().top - offsetScroll }, 600);
455        });
456
457        /* Header Remove Index */
458        $('.pxl-header--rmindex').parents('#pxl-header-elementor').addClass('pxl-header--rmindex-action');
459
460    });
461    
462    jQuery(document).ajaxComplete(function(event, xhr, settings){
463        jackcerra_shop_quantity();
464    });
465
466    jQuery( document ).on( 'updated_wc_div', function() {
467        jackcerra_shop_quantity();
468    } );
469     
470    /* Header Sticky */
471    function jackcerra_header_sticky() {
472        if($('#pxl-header-elementor').hasClass('is-sticky')) {
473            if (pxl_scroll_top > 100) {
474                $('.pxl-header-elementor-sticky.pxl-sticky-stb').addClass('pxl-header-fixed');
475                $('#pxl-header-mobile').addClass('pxl-header-mobile-fixed');
476            } else {
477                $('.pxl-header-elementor-sticky.pxl-sticky-stb').removeClass('pxl-header-fixed');
478                $('#pxl-header-mobile').removeClass('pxl-header-mobile-fixed');
479            }
480
481            if (pxl_scroll_status == 'up' && pxl_scroll_top > 100) {
482                $('.pxl-header-elementor-sticky.pxl-sticky-stt').addClass('pxl-header-fixed');
483            } else {
484                $('.pxl-header-elementor-sticky.pxl-sticky-stt').removeClass('pxl-header-fixed');
485            }
486        }
487
488        $('.pxl-header-elementor-sticky').parents('body').addClass('pxl-header-sticky');
489    }
490
491    /* Header Mobile */
492    function jackcerra_header_mobile() {
493        var h_header_mobile = $('#pxl-header-elementor').outerHeight();
494        if(pxl_window_width < 1199) {
495            $('#pxl-header-elementor').css('min-height', h_header_mobile + 'px');
496        }
497    }
498
499    /* Scroll To Top */
500    function jackcerra_scroll_to_top() {
501        if (pxl_scroll_top < pxl_window_height) {
502            $('.pxl-scroll-top').addClass('pxl-off').removeClass('pxl-on');
503        }
504        if (pxl_scroll_top > pxl_window_height) {
505            $('.pxl-scroll-top').addClass('pxl-on').removeClass('pxl-off');
506        }
507    }
508
509    /* Footer Fixed */
510    function jackcerra_footer_fixed() {
511        setTimeout(function(){
512            var h_footer = $('.pxl-footer-fixed #pxl-footer-elementor').outerHeight() - 1;
513            $('.pxl-footer-fixed #pxl-main').css('margin-bottom', h_footer + 'px');
514        }, 600);
515    }
516
517    /* WooComerce Quantity */
518    function jackcerra_shop_quantity() {
519        "use strict";
520        $('#pxl-wapper .quantity').append('<span class="quantity-icon quantity-down pxl-icon--minus"></span><span class="quantity-icon quantity-up pxl-icon--plus"></span>');
521        $('.quantity-up').on('click', function () {
522            $(this).parents('.quantity').find('input[type="number"]').get(0).stepUp();
523            $(this).parents('.woocommerce-cart-form').find('.actions .button').removeAttr('disabled');
524        });
525        $('.quantity-down').on('click', function () {
526            $(this).parents('.quantity').find('input[type="number"]').get(0).stepDown();
527            $(this).parents('.woocommerce-cart-form').find('.actions .button').removeAttr('disabled');
528        });
529        $('.quantity-icon').on('click', function () {
530            var quantity_number = $(this).parents('.quantity').find('input[type="number"]').val();
531            var add_to_cart_button = $(this).parents( ".product, .woocommerce-product-inner" ).find(".add_to_cart_button");
532            add_to_cart_button.attr('data-quantity', quantity_number);
533            add_to_cart_button.attr("href", "?add-to-cart=" + add_to_cart_button.attr("data-product_id") + "&quantity=" + quantity_number);
534        });
535        $('.woocommerce-cart-form .actions .button').removeAttr('disabled');
536    }
537
538    /* Menu Responsive Dropdown */
539    function jackcerra_submenu_responsive() {
540        var $jackcerra_menu = $('.pxl-header-elementor-main');
541        $jackcerra_menu.find('.pxl-menu-primary li').each(function () {
542            var $jackcerra_submenu = $(this).find('> ul.sub-menu');
543            if ($jackcerra_submenu.length == 1) {
544                if ( ($jackcerra_submenu.offset().left + $jackcerra_submenu.width() + 0 ) > $(window).width()) {
545                    $jackcerra_submenu.addClass('pxl-sub-reverse');
546                }
547            }
548        });
549    }
550
551    /* Menu Column Stretch Left/Right */
552    function jackcerra_column_stretch() {
553        var $column_stretch = $('.pxl-column--bg.pxl-column-stretch-right, .pxl-column--bg.pxl-column-stretch-left');
554        $column_stretch.each(function () {
555            if ($column_stretch.length == 1) {
556                var $col_offset = $column_stretch.offset().left;
557                var $width_el = $column_stretch.outerWidth();;
558                var $number_stretch = pxl_window_width - $col_offset - $width_el;
559                var $t = $width_el + $number_stretch + 15;
560
561                $column_stretch.css('width', $t + 'px');
562            }
563        });
564    }
565
566})(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.