PageSourceSearch

https://www.westofengland-ca.gov.uk/growth-hub/wp-content/themes/weca/assets/js/common.js?ver=1.3.1787730261

js westofengland-ca.gov.uk collected 2026-09-27 21:32:03 UTC 64,542 bytes, 1,605 lines download raw bytes

1/* ====IE Browser support message==== */
2if (navigator.userAgent.indexOf("MSIE") >= 0) {
3    document.getElementById('outdated').setAttribute("style", "display:block");
4}
5(function ($) { /* counter */
6
7
8
9    /*===================================================
10                         Home video
11     ===================================================*/
12    $(window).on("load", function () {
13        $('.main-banner:not(.internal-pages) .bg-cover').addClass('is-load');
14    })
15    /* if ($("body").find(".video-player").length) {
16        document.addEventListener('DOMContentLoaded', function () {
17            var controls = [];
18            var player = new Plyr('.video-player', {
19                controls: controls,
20                ended: true,
21                youtube: { noCookie: false, rel: 0, showinfo: 0, modestbranding: 0 },
22                resetOnEnd: true,
23                settings: ['loop'],
24                autoplay: true,
25                muted: true,
26                volume: 0
27            });
28            player.on('ended', function () {
29                player.play();
30            });
31            player.on('ready', function () {
32                player.play();
33            });
34
35            window.player = player;
36
37            function on(selector, type, callback) {
38                document.querySelector(selector).addEventListener(type, callback, false);
39            }
40
41            on('.video-play', 'click', function () {
42                $('.main-banner .bg-cover .plyr').addClass("is-visible");
43                player.play();
44                player.volume = 0.5;
45                player.muted = false;
46                $(".video-play").hide();
47                $(".video-stop").show().focus();;
48                $(".video-mute").show();
49                $(".video-unmute").hide();
50            });
51
52            on('.video-mute', 'click', function () {
53                player.muted = true;
54                $(".video-mute").hide();
55                $(".video-unmute").show().focus();
56
57            });
58            on('.video-unmute', 'click', function () {
59                player.volume = 0.5;
60                player.muted = false;
61                $(".video-mute").show().focus();
62                $(".video-unmute").hide();
63            });
64
65            on('.video-stop', 'click', function () {
66                player.pause();
67                $(".video-play").show().focus();
68                $(".video-stop").hide();
69                $(".video-mute").show();
70                $(".video-unmute").hide();
71                $('.main-banner .bg-cover .plyr').removeClass("is-visible");
72            });
73        });
74    } */
75    /*===================================================
76                        Home video Transcript
77    ===================================================*/
78    $('.video-block .btn-transcript').on("click", function () {
79        $(this).toggleClass("is-open");
80        //;
81        if ($(this).hasClass('is-open')) {
82            $(this).attr("aria-expanded", "true");
83            $(this).parents('.video-block').find(".video-transcript").slideDown()
84        } else {
85            $(this).parents('.video-block').find(".video-transcript").slideUp()
86            $(this).attr("aria-expanded", "false");
87        }
88    })
89
90
91    $('.video-left-right .btn-transcript').on("click", function () {
92        $(this).toggleClass("is-open");
93        if ($(this).hasClass('is-open')) {
94            $(this).attr("aria-expanded", "true");
95            $(this).parents('.video-left-right').find(".video-transcript").slideDown()
96        } else {
97            $(this).parents('.video-left-right').find(".video-transcript").slideUp()
98            $(this).attr("aria-expanded", "false");
99        }
100    })
101    /*===================================================
102                        Back to top button
103     ===================================================*/
104
105
106    if ($(window).width() < 1200) {
107        $(".back-to-top").on('click', function (e) {
108
109            e.preventDefault();
110            $('html, body').animate({ scrollTop: 0 }, '300');
111        });
112    }
113    $(window).on('resize', function () {
114        if ($(window).width() < 1200) {
115            $(".back-to-top").on('click', function (e) {
116                e.preventDefault();
117                $('html, body').animate({ scrollTop: 0 }, '300');
118            });
119        }
120    })
121    /*===================================================
122                       Slideup
123     ===================================================*/
124
125    $.fn.isInViewport = function () {
126        if ($(this).length > 0) {
127            var elementTop = $(this).offset().top + ($(this).height() / 4);
128            var elementBottom = elementTop + $(this).outerHeight();
129
130            var viewportTop = $(window).scrollTop();
131            var viewportBottom = viewportTop + $(window).height();
132
133            return elementBottom > viewportTop && elementTop < viewportBottom;
134        }
135
136    };
137    $(window).on('resize scroll', function () {
138        $('.slide-image-up').each(function () {
139            if ($(this).isInViewport() && $('.slide-image-up').length > 0) {
140                $(this).addClass("up-img");
141            }
142        });
143        $('.slide-image-up-half').each(function () {
144            if ($(this).isInViewport() && $('.slide-image-up-half').length > 0) {
145                $(this).addClass("up-img");
146            }
147        });
148    });
149    $('.slide-image-up').each(function () {
150        if ($(this).isInViewport() && $('.slide-image-up').length > 0) {
151            $(this).addClass("up-img");
152        }
153    });
154    $('.slide-image-up-half').each(function () {
155        if ($(this).isInViewport() && $('.slide-image-up-half').length > 0) {
156            $(this).addClass("up-img");
157        }
158    });
159    /*===================================================
160                               Stats
161        ===================================================*/
162
163    var scrollMount = 0;
164    $('.stats-wrap').each(function () {
165        if ($(this).isInViewport() && $('.stats-wrap').length > 0) {
166
167            var oTop = $('.stats-wrap').offset().top - window.innerHeight;
168            if (scrollMount == 0 && $(window).scrollTop() > oTop) {
169                $('.stats-number').each(function (index) {
170                    /*  $(this).parents(".stat-single").find(".stats-line").addClass("stat-ani"); */
171                    $(this).parents(".stats-number-wrap").addClass("stat-ani");
172                    var size = $(this).text().split(".")[1] ? $(this).text().split(".")[1].length : 0;
173                    $(this).prop('Counter', 0).animate({
174                        Counter: $(this).text()
175                    }, {
176                        duration: 2000,
177                        easing: 'swing',
178                        step: function (now) {
179                            $(this).text(parseFloat(now).toFixed(size).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
180                        }
181                    });
182                });
183                scrollMount = 1;
184            }
185        }
186
187    });
188
189    $(window).scroll(function () {
190        if ($("body").find(".stats-wrap").length) {
191            var oTop = $('.stats-wrap').offset().top - window.innerHeight;
192            if (scrollMount == 0 && $(window).scrollTop() > oTop) {
193                $('.stats-number').each(function (index) {
194
195                    $(this).parents(".stats-number-wrap").addClass("stat-ani");
196                    var size = $(this).text().split(".")[1] ? $(this).text().split(".")[1].length : 0;
197                    $(this).prop('Counter', 0).animate({
198                        Counter: $(this).text()
199                    }, {
200                        duration: 2000,
201                        easing: 'swing',
202                        step: function (now) {
203                            $(this).text(parseFloat(now).toFixed(size).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
204                        }
205                    });
206                });
207                scrollMount = 1;
208            }
209        }
210    });
211    /*===================================================
212                      News slider
213     ===================================================*/
214    if ($("body").find(".news-slider").length) {
215        var newSlider = $(".news-slider");
216        newSlider.on("init", function (event, slick) {
217            $(".news-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
218        });
219        newSlider.on("afterChange", function (event, slick, currentSlide) {
220            $(".news-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
221        });
222        const newsoptions = {
223            dots: true,
224            slidesToShow: 1.05,
225            autoplay: false,
226            arrows: false,
227            dots: true,
228            slide: 'li',
229            accessibility: false,
230            mobileFirst: true,
231            responsive: [{
232                breakpoint: 768,
233                settings: 'unslick'
234            }]
235        };
236        newSlider.slick(newsoptions);
237
238        $(window).resize(function () {
239            setTimeout(function () {
240                if ($(window).width() < 768 && !newSlider.hasClass("slick-initialized")) {
241                    newSlider.slick(newsoptions);
242                }
243            }, 100);
244        });
245    }
246    /*===================================================
247                     WHAT’S NEW
248     ===================================================*/
249    if ($("body").find(".whatnew-slider").length) {
250        var whatSlider = $(".whatnew-slider");
251        whatSlider.on("init", function (event, slick) {
252            $(".whatnew-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
253        });
254        whatSlider.on("afterChange", function (event, slick, currentSlide) {
255            $(".whatnew-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
256        });
257        const whatoptions = {
258            dots: true,
259            slidesToShow: 1,
260            autoplay: false,
261            arrows: false,
262            dots: true,
263            slide: '.custom-col-4',
264            accessibility: false,
265            mobileFirst: true,
266            responsive: [{
267                breakpoint: 768,
268                settings: 'unslick'
269            }]
270        };
271        whatSlider.slick(whatoptions);
272
273        $(window).resize(function () {
274            setTimeout(function () {
275                if ($(window).width() < 768 && !whatSlider.hasClass("slick-initialized")) {
276                    whatSlider.slick(whatoptions);
277                }
278            }, 100);
279        });
280    }
281    /*===================================================
282                    Case study slider
283     ===================================================*/
284
285    if ($("body").find(".case-study-slider").length) {
286        $('.case-study-slider').each(function () {
287            var $this = $(this);
288
289            function updateArrowDisabledState($container) {
290                $container.find('.slick-arrow').each(function () {
291                    if ($(this).hasClass('slick-disabled')) {
292                        $(this).attr('disabled', 'disabled');
293                    } else {
294                        $(this).removeAttr('disabled');
295                    }
296                });
297            }
298
299            $this.on("init", function (event, slick) {
300                var $container = $this.parents('.case-study-wrap');
301
302                $container.find(".content-image-count").html(
303                    '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
304                    (slick.currentSlide + 1) +
305                    '/<span class="sr-only" aria-label="Of">Of</span> ' +
306                    slick.slideCount
307                );
308
309                updateArrowDisabledState($container);
310            });
311
312            $this.on("afterChange", function (event, slick, currentSlide) {
313                var $container = $this.parents('.case-study-wrap');
314
315                $container.find(".content-image-count").html(
316                    '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
317                    (currentSlide + 1) +
318                    '/<span class="sr-only" aria-label="Of">Of</span>' +
319                    slick.slideCount
320                );
321
322                updateArrowDisabledState($container);
323            });
324
325            $this.slick({
326                dots: false,
327                slidesToShow: 3,
328                autoplay: false,
329                arrows: true,
330                infinite: false,
331                slide: '.c-slide',
332                accessibility: true,
333                prevArrow: $this.parents('.case-study-wrap').find('.dlv-prev2'),
334                nextArrow: $this.parents('.case-study-wrap').find('.dlv-next2'),
335                responsive: [
336                    {
337                        breakpoint: 991,
338                        settings: {
339                            slidesToShow: 2,
340                            prevArrow: $this.parents('.case-study-wrap').find('.dlv-prev'),
341                            nextArrow: $this.parents('.case-study-wrap').find('.dlv-next'),
342                        }
343                    },
344                    {
345                        breakpoint: 767,
346                        settings: {
347                            slidesToShow: 1.1,
348                            prevArrow: $this.parents('.case-study-wrap').find('.dlv-prev'),
349                            nextArrow: $this.parents('.case-study-wrap').find('.dlv-next'),
350                        }
351                    }
352                ]
353            });
354
355            $(window).on('resize orientationchange', function () {
356                $this.slick('resize');
357            });
358        });
359    }
360
361    /*===================================================
362                        selectpicker
363    ===================================================*/
364    if ($("body").find(".selectpicker").length) {
365        $('.selectpicker').selectpicker({
366            styleBase: "select-btn",
367            style: "dd",
368            tabindex: "-98"
369        });
370
371        $('.selectpicker').on('changed.bs.select', function (e, clickedIndex, isSelected, previousValue) {
372            $(".select-btn").removeAttr("tabindex");
373            console.log("1")
374        });
375        $('.selectpicker').on('shown.bs.select', function (e, clickedIndex, isSelected, previousValue) {
376            $(".select-btn").removeAttr("tabindex");
377            console.log("2")
378        });
379
380        $('.select-btn').on('focus, focusout', function (e, clickedIndex, isSelected, previousValue) {
381            setTimeout(function () {
382                $(".select-btn").removeAttr("tabindex");
383                $('.bootstrap-select').find('.selectpicker').attr('aria-hidden', 'true').attr('tabindex', '-1');
384            }, 100)
385
386        });
387        $(window).on('load', function () {
388            setTimeout(function () {
389                $('.bootstrap-select>select.selectpicker').each(function () {
390                    $(this).attr('aria-hidden', 'true').attr('tabindex', '-1');
391                    $(this).parents('.bootstrap-select').find('.select-btn').attr('aria-hidden', 'false').attr('tabindex', '0');
392                })
393            }, 500)
394        })
395    }
396    /*===================================================
397                        news-filter
398    ===================================================*/
399
400    $('.filter-btn').on("click", function () {
401        var $this = $(this);
402        if ($this.hasClass('is-open')) {
403            $('.mobile-wrap-toggle').slideUp();
404            $this.removeClass('is-open').text('Open filters').attr('aria-expanded', 'false');
405        } else {
406            $this.addClass('is-open').text('Close filters').attr('aria-expanded', 'true');
407            $('.mobile-wrap-toggle').slideDown();
408        }
409    });
410
411
412    $(document).on("click", '.video-left-right .plyr__control[data-plyr="play"]', function () {
413        var $this = $(this);
414        setTimeout(function () {
415            if ($this.parents('.video-left-right').find('.plyr').hasClass('plyr--playing')) {
416
417                $this.parents('.video-left-right').find('.pause-custom').css("display", "inline-block");
418                $this.parents('.video-left-right').find('.play-custom').css("display", "none");
419            } else if ($this.parents('.video-left-right').find('.plyr').hasClass('plyr--paused')) {
420
421                $this.parents('.video-left-right').find('.pause-custom').css("display", "none");
422                $this.parents('.video-left-right').find('.play-custom').css("display", "inline-block");
423            } else {
424
425            }
426        }, 200)
427    })
428    $('.play-custom, .pause-custom').on("click", function () {
429        $(this).parents('.video-left-right').find('.plyr__control--overlaid').trigger("click");
430    });
431
432
433    $(document).on("click", '.video-left-right  .plyr__control[data-plyr="mute"]', function () {
434
435        var $this = $(this);
436        setTimeout(function () {
437            if ($this.parents('.video-left-right').find('.plyr__control[data-plyr="mute"]').hasClass('plyr__control--pressed')) {
438                $this.parents('.video-left-right').find('.mute-custom').css("display", "none");
439                $this.parents('.video-left-right').find('.unmute-custom').css("display", "inline-block");
440
441            } else {
442                $this.parents('.video-left-right').find('.mute-custom').css("display", "inline-block");
443                $this.parents('.video-left-right').find('.unmute-custom').css("display", "none");
444
445            }
446        }, 200)
447    })
448    $('.mute-custom, .unmute-custom').on("click", function () {
449        $(this).parents('.video-left-right').find('.plyr__control[data-plyr="mute"]').trigger("click");
450
451    });
452
453    /*===================================================
454                         Home video
455     ===================================================*/
456    if ($("body").find(".header-in").length) {
457        var bodyTopPadding;
458        if ($("body").hasClass("admin-bar")) {
459            bodyTopPadding = $(".top-header").height() + $(".main-header").height() + $("#wpadminbar").height();
460        } else {
461            bodyTopPadding = $(".top-header").height() + $(".main-header").height();
462        }
463
464        $(".header").css("min-height", bodyTopPadding);
465        $('.header-in').addClass("is-fixed");
466    }
467    $(window).on('scroll', function () {
468        if ($("body").find(".header .header-in").length) {
469            var bodyTopPadding;
470            if ($("body").hasClass("admin-bar")) {
471                bodyTopPadding = $(".top-header").height() + $(".main-header").height() + $("#wpadminbar").height();
472            } else {
473                bodyTopPadding = $(".top-header").height() + $(".main-header").height();
474            }
475            $(".header").css("min-height", bodyTopPadding);
476            $('.header-in').addClass("is-fixed");
477        }
478    })
479
480    /*===================================================
481                         Mobile menu
482     ===================================================*/
483    $(".header-in #mega-menu-wrap-primary ul > li > ul > li > ul > li > ul > li > div > ul > li > ul").each(function () {
484        var $this = $(this);
485        $this.parent('li').parent("ul").addClass("sub-menu-up");
486        $this.addClass("sub-menu");
487    });
488    $(".header-in #mega-menu-wrap-primary > ul > li").each(function () {
489        var $this = $(this);
490        if ($(this).find("ul").length) {
491            $this.children("a").after("<button class='nav-arrow nav-arrow-top' aria-expanded='true'>arrow</button>")
492            /* $this.prepend("<button class='nav-arrow nav-arrow-top' aria-expanded='true'>arrow</button>"); */
493            $this.children('.mega-sub-menu').addClass('mobile-first-dropdown');
494        }
495    })
496    $(".header-in #mega-menu-wrap-primary ul > li > ul > li > ul > li > ul > li > div > ul > li").each(function () {
497        var $this = $(this);
498        if ($(this).find("ul").length) {
499            $this.children("a").after("<button class='nav-arrow nav-arrow-middle' aria-expanded='true'>arrow</button>")
500
501            /* $this.prepend("<button class='nav-arrow nav-arrow-middle' aria-expanded='true'>arrow</button>"); */
502        }
503    });
504    $(document).on('click', '.header-in #mega-menu-wrap-primary > ul > li> .nav-arrow-top', function () {
505        /* $(this).parent("li").children(".mega-sub-menu").slideToggle(); */
506        if ($(this).hasClass('is-open')) {
507            $(this).parent("li").removeClass('is-expand');
508            $(this).attr("aria-expanded", "true");
509            $(this).removeClass('is-open');
510            $(this).parent("li").children(".mega-sub-menu").slideUp();
511        } else {
512            $('.header-in #mega-menu-wrap-primary  .nav-arrow-top').removeClass('is-open');
513            $(".header-in .mega-menu-wrap ul li ").removeClass('is-expand');
514            $(".mega-sub-menu.mobile-first-dropdown").slideUp();
515            $(this).next("a").attr("aria-expanded", "false");
516            $(this).parent("li").addClass('is-expand');;
517            $(this).addClass('is-open');
518            $(this).parent("li").children(".mega-sub-menu").slideDown();
519        }
520    })
521    $(document).on('click', '.header-in #mega-menu-wrap-primary ul > li > ul > li > ul > li > ul > li > div > ul > li .nav-arrow-middle', function () {
522        /* $(this).parent("li").children(".sub-menu").slideToggle(); */
523
524        if ($(this).hasClass('is-open')) {
525            $(this).attr("aria-expanded", "true");
526            $(this).removeClass('is-open');
527            $(this).parent("li").children(".sub-menu").slideUp();
528        } else {
529            $('.header-in #mega-menu-wrap-primary  .nav-arrow-middle').removeClass('is-open');
530            $(".sub-menu").slideUp();
531            $(this).next("a").attr("aria-expanded", "false");
532            $(this).addClass('is-open');
533            $(this).parent("li").children(".sub-menu").slideDown();
534        }
535    })
536    $('.top-search a').replaceWith('<button aria-expanded="false" class="mega-menu-link">Search</buton>');
537
538    $(document).on('click', '.hamburger-menu', function () {
539        $(".top-search-box").slideUp();
540        $('.mobile-search-menu').removeClass("is-open");
541        $("#mega-menu-wrap-primary").slideToggle();
542        $(this).toggleClass("hbm-open");
543        $(this).focus();
544        $(".search-open").slideUp();
545        if ($(this).hasClass('hbm-open')) {
546            $(this).attr("aria-expanded", "true");
547
548        } else {
549            $(this).attr("aria-expanded", "false");
550        }
551    });
552    $(".header #mega-menu-wrap-primary #mega-menu-primary>li.mega-menu-item-has-children > a.mega-menu-link").attr("role", "button");
553    /*===================================================
554                         Search
555     ===================================================*/
556
557    $(document).on("click", ".header-in nav#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item:not(.top-search)", function () {
558        $(".mobile-search-menu").removeClass("is-open");
559        $(".top-search  a, .top-search  button, .top-search-new  button").removeClass("is-open");
560        $(".top-search-box").css("display", "none");
561    })
562    $(document).on("click", ".top-search  a, .top-search  button, .top-search-new  button", function () {
563        $(".mobile-search-menu").toggleClass("is-open");
564        $(".top-search-box").slideToggle();
565        $(".header-in nav#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item").removeClass("mega-toggle-on");
566        $(this).toggleClass("is-open");
567        if ($(this).hasClass('is-open')) {
568            $(this).attr("aria-expanded", "true");
569        } else {
570            $(this).attr("aria-expanded", "false");
571        }
572    })
573    $(document).on('keydown', function (event) {
574        if (event.key == "Escape") {
575            $(".mobile-search-menu").removeClass("is-open");
576            $(".top-search-box").css("display", "none");
577            $(".top-search  a, .top-search  button, .top-search-new  button").removeClass("is-open");
578            $(".header-in nav#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item").removeClass("mega-toggle-on");
579
580        }
581    });
582
583    $(document).on("click", ".mobile-search-menu", function () {
584        $('.hamburger-menu').removeClass('hbm-open');
585        $(".header-in #mega-menu-wrap-primary").slideUp();
586        $(".top-search-box").slideToggle();
587        $('.top-search a, .top-search  button, .top-search-new  button').toggleClass("is-open");
588        $(this).toggleClass("is-open");
589        if ($(this).hasClass('is-open')) {
590            $(this).attr("aria-expanded", "true");
591            $('.top-search-box input[type="text"]').focus();
592
593        } else {
594            $(this).attr("aria-expanded", "false");
595            $(this).focus();
596        }
597    })
598   function addSrOnlyToExternalLinks() {
599            $('.support-services-page a[href]').each(function() {
600                var link = $(this);
601                var href = link.attr('href');
602
603                if (!href || href.startsWith('#') || href.startsWith('mailto:')) return;
604
605                var isExternal = this.hostname && this.hostname !== location.hostname;
606
607                if (isExternal) {
608                    if (link.find('.sr-only').length === 0) {
609                        link.append('<span class="sr-only">(opens in a new tab)</span>');
610                    }
611                }
612            });
613        }
614
615         addSrOnlyToExternalLinks();
616        $(document).ajaxComplete(function() {
617            addSrOnlyToExternalLinks();
618        });
619    /*===================================================
620                         Mobile footer
621     ===================================================*/
622    $('.footer .menu-item-has-children').each(function () {
623        $(this).prepend('<button class="footer-plus" aria-expanded="false">Button</button>');
624    });
625
626
627    $(".footer  .menu-item-has-children ").on("click", ".footer-plus", function () {
628
629        $(".footer  .menu-item-has-children .footer-plus").attr("aria-expanded", "false");
630        if ($(this).parents(".footer .menu-item-has-children").hasClass("footer-removeplus")) {
631            $(this).attr("aria-expanded", "false");
632        } else {
633            $(this).attr("aria-expanded", "true");
634        }
635        $(this).parents(".footer .menu-item-has-children").toggleClass("footer-removeplus").find(".sub-menu").slideToggle();
636        $(".footer  .menu-item-has-children .sub-menu").not($(this).parents(".footer .menu-item-has-children").find(".sub-menu")).slideUp(300);
637        $(".footer .menu-item-has-children").not($(this).parents(".footer .menu-item-has-children")).removeClass("footer-removeplus");
638
639    });
640
641    /*===================================================
642                         Menu active link
643     ===================================================*/
644    $('.header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link').each(function () {
645    var $this = $(this);
646    var currentUrl = window.location.pathname + window.location.search;
647    var linkUrl = this.pathname + this.search;
648    if ($(this).attr('href') === "#" || this.hash) {
649        return;
650    }
651    if (!window.location.hash && !this.hash && linkUrl === currentUrl) {
652        $this.parents('.mega-menu-item').addClass('is-parent-active');
653    }
654});
655
656$('.header #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu > ul.mega-sub-menu > .mega-menu-row > ul.mega-sub-menu > li > ul > li > div > ul   li a').each(function () {
657    var $this = $(this);
658    var currentUrl = window.location.pathname + window.location.search;
659    var linkUrl = this.pathname + this.search;
660    if ($(this).attr('href') === "#" || this.hash) {
661        return;
662    }
663
664    if (!window.location.hash && linkUrl === currentUrl) {
665        $this.addClass('active-menu');
666        $this.parents('.mega-menu-item').addClass('is-parent-active');
667    }
668});
669
670
671
672
673    /*===================================================
674                         testimonials slider
675     ===================================================*/
676
677    if ($("body").find(".testimonials-slider").length) {
678
679        var testimonialsSlider = $(".testimonials-slider");
680
681        testimonialsSlider.slick({
682            dots: true,
683            slidesToShow: 1,
684            autoplay: false,
685            arrows: true,
686            dots: false,
687            accessibility: false,
688            infinite: false,
689        });
690    }
691    /*===================================================
692                  Faq accordian
693     ===================================================*/
694
695    $('.faq-title').click(function (j) {
696        var dropDown = $(this).parents('.faq-card').find('.faq-panel');
697        var $this = $(this);
698        $(this).closest('.faq-accordian').find('.faq-panel').not(dropDown).slideUp();
699        $('.faq-accordian').not(dropDown).find('.faq-title').attr("aria-expanded", "false");;
700        //dropDown.focus();
701        if ($(this).hasClass('active')) {
702            $(this).removeClass('active');
703            $(this).attr("aria-expanded", "false");
704        } else {
705            /* setTimeout(function() {
706                $('html, body').animate({
707                    scrollTop: $this.offset().top
708                }, 500);
709            }, 800) */
710            $(this).closest('.faq-accordian').find('.faq-title.active').removeClass('active');
711            $(this).addClass('active');
712            $(this).attr("aria-expanded", "true");
713        }
714
715        dropDown.stop(false, true).slideToggle();
716        j.preventDefault();
717    });
718
719
720    /*===================================================
721                  right accordian
722     ===================================================*/
723
724    $('.right-title').click(function (j) {
725        var dropDown = $(this).parents('.right-card').find('.right-panel');
726        var $this = $(this);
727        $(this).closest('.right-accordian').find('.right-panel').not(dropDown).slideUp();
728        $('.right-accordian').not(dropDown).find('.right-title').attr("aria-expanded", "false");
729        //dropDown.focus();
730        if ($(this).hasClass('active')) {
731            $(this).removeClass('active');
732            $(this).attr("aria-expanded", "false");
733        } else {
734            /* setTimeout(function() {
735                $('html, body').animate({
736                    scrollTop: $this.offset().top
737                }, 500);
738            }, 800) */
739            $(this).closest('.right-accordian').find('.right-title.active').removeClass('active');
740            $(this).addClass('active');
741            $(this).attr("aria-expanded", "true");
742        }
743
744        dropDown.stop(false, true).slideToggle();
745        j.preventDefault();
746    });
747
748    /*===================================================
749                      future slider
750     ===================================================*/
751    if ($("body").find(".future-slider").length) {
752        var futureSlider = $(".future-slider");
753        futureSlider.on("init", function (event, slick) {
754            $(".future-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
755        });
756        futureSlider.on("afterChange", function (event, slick, currentSlide) {
757            $(".future-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
758        });
759        futureSlider.slick({
760            dots: true,
761            slidesToShow: 8,
762            autoplay: false,
763            arrows: true,
764            dots: false,
765            infinite: false,
766            accessibility: false,
767            responsive: [{
768                breakpoint: 1280,
769                settings: {
770                    slidesToShow: 6,
771                }
772            },
773            {
774                breakpoint: 1200,
775                settings: {
776                    slidesToShow: 5,
777                }
778            },
779            {
780                breakpoint: 992,
781                settings: {
782                    slidesToShow: 4,
783                }
784            },
785            {
786                breakpoint: 768,
787                settings: {
788                    slidesToShow: 3,
789                    dots: true,
790                    arrows: false
791                }
792            },
793            {
794                breakpoint: 575,
795                settings: {
796                    slidesToShow: 2.1,
797                    dots: true,
798                    arrows: false
799                }
800            }
801            ]
802        });
803
804    }
805
806
807    /*===================================================
808                      table-slider
809     ===================================================*/
810    if ($("body").find(".table-slider").length) {
811        var tableItems;
812        var tableItemsBox;
813        $(".table-slider").each(function () {
814            tableItems = $(this).find(".common-content").length;
815
816            if ($(this).find(".common-content").length == 1) {
817                tableItemsBox = tableItems;
818                $(this).addClass("crt-1");
819            } else if ($(this).find(".common-content").length == 2) {
820                tableItemsBox = tableItems;
821                $(this).addClass("crt-2");
822            } else if ($(this).find(".common-content").length == 3) {
823                tableItemsBox = tableItems;
824                $(this).addClass("crt-3");
825            } else if ($(this).find(".common-content").length == 4) {
826                tableItemsBox = tableItems;
827                $(this).addClass("crt-4");
828            } else if ($(this).find(".common-content").length == 5) {
829                tableItemsBox = tableItems;
830                $(this).addClass("crt-5");
831            } else {
832                tableItemsBox = 6;
833                $(this).addClass("crt-6");
834            }
835
836            var tableSlider = $(this);
837            tableSlider.on("init", function (event, slick) {
838                $(tableSlider).find(".content-image-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
839            });
840            tableSlider.on("afterChange", function (event, slick, currentSlide) {
841                $(tableSlider).find(".content-image-count").text(parseInt(slick.currentSlide + 1) + ' / ' + slick.slideCount);
842            });
843            tableSlider.slick({
844                dots: true,
845                slidesToShow: tableItemsBox,
846                autoplay: false,
847                arrows: true,
848                dots: false,
849                infinite: false,
850                accessibility: false,
851                prevArrow: $(this).parents('.table-slider-wrap').find('.dlv-prev2'),
852                nextArrow: $(this).parents('.table-slider-wrap').find('.dlv-next2'),
853                responsive: [{
854                    breakpoint: 1280,
855                    settings: {
856                        slidesToShow: tableItemsBox,
857                        prevArrow: $(this).parents('.table-slider-wrap').find('.dlv-prev'),
858                        nextArrow: $(this).parents('.table-slider-wrap').find('.dlv-next'),
859                    }
860                },
861                {
862                    breakpoint: 1200,
863                    settings: {
864                        slidesToShow: 4,
865                        prevArrow: $(this).parents('.table-slider-wrap').find('.dlv-prev'),
866                        nextArrow: $(this).parents('.table-slider-wrap').find('.dlv-next'),
867                    }
868                },
869                {
870                    breakpoint: 992,
871                    settings: {
872                        slidesToShow: 3,
873                        prevArrow: $(this).parents('.table-slider-wrap').find('.dlv-prev'),
874                        nextArrow: $(this).parents('.table-slider-wrap').find('.dlv-next'),
875                    }
876                },
877                {
878                    breakpoint: 768,
879                    settings: {
880                        slidesToShow: 2,
881                        prevArrow: $(this).parents('.table-slider-wrap').find('.dlv-prev'),
882                        nextArrow: $(this).parents('.table-slider-wrap').find('.dlv-next'),
883                    }
884                },
885                {
886                    breakpoint: 575,
887                    settings: {
888                        slidesToShow: 1.1,
889                        dots: false,
890                        prevArrow: $(this).parents('.table-slider-wrap').find('.dlv-prev'),
891                        nextArrow: $(this).parents('.table-slider-wrap').find('.dlv-next'),
892                    }
893                }
894                ]
895            });
896        });
897
898    }
899
900    /*===================================================
901                    Continue slider
902     ===================================================*/
903    if ($("body").find(".continue-slider").length) {
904        $('.continue-slider').each(function () {
905            var $this = $(this);
906            items = $(this).find(".common-content").length;
907            if ($(this).find(".common-content").length > 5) {
908                items = 5;
909            }
910            // Reusable function to update arrow disabled state
911            function updateArrowDisabledState($container) {
912                $container.find('.slick-arrow').each(function () {
913                    if ($(this).hasClass('slick-disabled')) {
914                        $(this).attr('disabled', 'disabled');
915                    } else {
916                        $(this).removeAttr('disabled');
917                    }
918                });
919            }
920            $this.on("init", function (event, slick) {
921                var $container = $this.parents('.continue-to');
922                $container.find(".content-image-count").html('<span class="sr-only" aria-label="Total slide out">Total slide out</span>' + parseInt(slick.currentSlide + 1) + '/<span class="sr-only" aria-label="Of">Of</span> ' + slick.slideCount);
923                updateArrowDisabledState($container);
924            });
925            $this.on("afterChange", function (event, slick, currentSlide) {
926                var $container = $this.parents('.continue-to');
927                $container.find(".content-image-count").html('<span class="sr-only" aria-label="Total slide out">Total slide out</span>' + parseInt(slick.currentSlide + 1) + '/<span class="sr-only" aria-label="Of">Of</span>' + slick.slideCount);
928                updateArrowDisabledState($container);
929            });
930            $this.slick({
931                dots: true,
932                slidesToShow: items,
933                autoplay: false,
934                arrows: true,
935                dots: false,
936                infinite: false,
937                accessibility: true,
938                prevArrow: $this.parents('.continue-to').find('.dlv-prev2'),
939                nextArrow: $this.parents('.continue-to').find('.dlv-next2'),
940                responsive: [
941                    {
942                        breakpoint: 1025,
943                        settings: {
944                            slidesToShow: 3,
945                            prevArrow: $this.parents('.continue-to').find('.dlv-prev2'),
946                            nextArrow: $this.parents('.continue-to').find('.dlv-next2'),
947                        }
948                    },
949                    {
950                        breakpoint: 991,
951                        settings: {
952                            slidesToShow: 3,
953                            prevArrow: $this.parents('.continue-to').find('.dlv-prev'),
954                            nextArrow: $this.parents('.continue-to').find('.dlv-next'),
955                        }
956                    },
957                    {
958                        breakpoint: 767,
959                        settings: {
960                            slidesToShow: 1.1,
961                            prevArrow: $this.parents('.continue-to').find('.dlv-prev'),
962                            nextArrow: $this.parents('.continue-to').find('.dlv-next'),
963                        }
964                    },
965                ]
966            });
967        })
968    }
969    /*===================================================
970                      Custom scrollbar
971     ===================================================*/
972
973
974    /*===================================================
975                        Referring organisation form Hide
976       ===================================================*/
977
978    /*  $('#referring-organisation').change(function() {
979         if (this.checked) {
980             $(this).prop("checked", function() {
981                 $(".form-container .hide-form").slideToggle();
982                 $(".form-container .hide-form .form-group:first-child input").focus();
983             });
984         } else {
985             $(".form-container .hide-form").slideToggle();
986         }
987     }); */
988    /* $('.header-in nav#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link[href^="/' + location.pathname.split("/")[1] + '"]').addClass('current-menu'); */
989    /*===================================================
990                         Content image  slider
991     ===================================================*/
992
993    if ($("body").find(".content-image-slider").length) {
994        $('.content-image-slider').each(function () {
995            var $this = $(this);
996
997            function updateArrowDisabledState($container) {
998                $container.find('.slick-arrow').each(function () {
999                    if ($(this).hasClass('slick-disabled')) {
1000                        $(this).attr('disabled', 'disabled');
1001                    } else {
1002                        $(this).removeAttr('disabled');
1003                    }
1004                });
1005            }
1006
1007            $this.on("init", function (event, slick) {
1008                var $container = $this.parents('.content-slider-with-left-right-image');
1009
1010                $container.find(".content-image-count").html(
1011                    '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
1012                    (slick.currentSlide + 1) +
1013                    '/<span class="sr-only" aria-label="Of">Of</span>' +
1014                    slick.slideCount
1015                );
1016                $container.find(".content-image-out").text(slick.currentSlide + 1);
1017                $container.find(".content-image-total").text(slick.slideCount);
1018
1019                updateArrowDisabledState($container);
1020            });
1021
1022            $this.on("afterChange", function (event, slick, currentSlide) {
1023                var $container = $this.parents('.content-slider-with-left-right-image');
1024
1025                $container.find(".content-image-count").html(
1026                    '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
1027                    (currentSlide + 1) +
1028                    '/<span class="sr-only" aria-label="Of">Of</span>' +
1029                    slick.slideCount
1030                );
1031                $container.find(".content-image-out").text(currentSlide + 1);
1032                $container.find(".content-image-total").text(slick.slideCount);
1033
1034                updateArrowDisabledState($container);
1035            });
1036
1037            $this.slick({
1038                slidesToShow: 1,
1039                autoplay: false,
1040                dots: false,
1041                accessibility: true,
1042                infinite: false,
1043                arrows: true,
1044                fade: true,
1045                prevArrow: $this.parents('.content-slider-with-left-right-image').find('.dlv-prev2'),
1046                nextArrow: $this.parents('.content-slider-with-left-right-image').find('.dlv-next2'),
1047                responsive: [{
1048                    breakpoint: 992,
1049                    settings: {
1050                        slidesToShow: 1,
1051                        arrows: true,
1052                        prevArrow: $this.parents('.content-slider-with-left-right-image').find('.dlv-prev'),
1053                        nextArrow: $this.parents('.content-slider-with-left-right-image').find('.dlv-next'),
1054                    }
1055                }]
1056            });
1057
1058            // Resize handling
1059            $(window).on('resize orientationchange', function () {
1060                $this.slick('resize');
1061            });
1062        });
1063    }
1064
1065
1066
1067    /*===================================================
1068                   Deliver slider
1069    ===================================================*/
1070
1071    if (jQuery("body").find(".deliver-slider").length) {
1072        var numDeliSlick = 0;
1073
1074        // Reusable function to update arrow disabled state
1075        function updateArrowDisabledState($container) {
1076            $container.find('.slick-arrow').each(function () {
1077                if ($(this).hasClass('slick-disabled')) {
1078                    $(this).attr('disabled', 'disabled');
1079                } else {
1080                    $(this).removeAttr('disabled');
1081                }
1082            });
1083        }
1084
1085        $('.deliver-slider').each(function () {
1086            var $this = $(this);
1087            numDeliSlick++;
1088
1089            var sliderClass = 'deliver-slider-' + numDeliSlick;
1090            $this.addClass(sliderClass);
1091
1092            var $container = $this.parents('.what-we-deliver');
1093            var $prevArrow = $container.find('.dlv-prev2');
1094            var $nextArrow = $container.find('.dlv-next2');
1095
1096            $this.on("init", function (event, slick) {
1097                $container.find(".content-image-count").html(
1098                    '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
1099                    (slick.currentSlide + 1) +
1100                    '/<span class="sr-only" aria-label="Of">Of</span> ' +
1101                    slick.slideCount
1102                );
1103                updateArrowDisabledState($container);
1104            });
1105
1106            $this.on("afterChange", function (event, slick, currentSlide) {
1107                $container.find(".content-image-count").html(
1108                    '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
1109                    (currentSlide + 1) +
1110                    '/<span class="sr-only" aria-label="Of">Of</span>' +
1111                    slick.slideCount
1112                );
1113                updateArrowDisabledState($container);
1114            });
1115
1116            $this.slick({
1117                arrows: true,
1118                infinite: false,
1119                slidesToShow: 1,
1120                slidesToScroll: 1,
1121                fade: true,
1122                accessibility: true,
1123                asNavFor: '.deliver-nav-' + numDeliSlick,
1124                prevArrow: $prevArrow,
1125                nextArrow: $nextArrow,
1126                responsive: [{
1127                    breakpoint: 992,
1128                    settings: {
1129                        slidesToShow: 1,
1130                        dots: false,
1131                        infinite: false,
1132                        arrows: true,
1133                        prevArrow: $container.find('.dlv-prev'),
1134                        nextArrow: $container.find('.dlv-next'),
1135                    }
1136                }]
1137            });
1138
1139            $(window).on('resize orientationchange', function () {
1140                $this.slick('resize');
1141            });
1142        });
1143
1144        // Reset counter for nav sliders
1145        numDeliSlick = 0;
1146
1147        $('.deliver-nav-slider').each(function () {
1148            numDeliSlick++;
1149            var navClass = 'deliver-nav-' + numDeliSlick;
1150            var $navSlider = $(this).addClass(navClass);
1151
1152            $navSlider.slick({
1153                vertical: false,
1154                infinite: false,
1155                arrows: false,
1156                slidesToShow: 4,
1157                slidesToScroll: 1,
1158                asNavFor: '.deliver-slider-' + numDeliSlick,
1159                accessibility: true,
1160                dots: false,
1161                focusOnSelect: true,
1162                centerMode: false
1163            });
1164
1165            $(window).on('resize orientationchange', function () {
1166                $navSlider.slick('resize');
1167            });
1168        });
1169    }
1170
1171
1172
1173
1174    /*===================================================
1175                 Contact Form Show/Hide
1176    ===================================================*/
1177    if ($("body").find(".close-form").length) {
1178        $('.close-form').on("click", function () {
1179            $(this).toggleClass('form-closed');
1180            $(this).siblings('.right-form').toggleClass('d-none');
1181            if ($(this).hasClass('form-closed')) {
1182                $(this).find("span").text('Open form');
1183                $(this).find("em").addClass('arrow-down').removeClass('arrow-up');
1184                $(this).attr("aria-expanded", "false");
1185            } else {
1186                $(this).attr("aria-expanded", "true");
1187                $(this).find("span").text('Hide form');
1188                $(this).find("em").addClass('arrow-up').removeClass('arrow-down');
1189            }
1190        });
1191    }
1192
1193    /*===================================================
1194                 Accordion For Filters
1195    ===================================================*/
1196    if ($("body").find(".accordion-button").length) {
1197        $('.accordion-button').on("click", function () {
1198            $(this).closest('.itemclass').find('.subfilter-checkbox').slideToggle();
1199            $(this).toggleClass('collapsed');
1200            if ($(this).hasClass('collapsed')) {
1201                $(this).attr("aria-expanded", "false");
1202                $(this).find(".icon-minus").addClass('icon-plus');
1203            } else {
1204                $(this).attr("aria-expanded", "true");
1205                $(this).find(".icon-minus").removeClass('icon-plus');
1206                $(this).closest('.itemclass').find('.subfilter-checkbox').removeClass('collapse');
1207            }
1208        });
1209    }
1210
1211
1212
1213
1214    /*===================================================
1215                 Grow services
1216    ===================================================*/
1217
1218    $(document).on('click', '.services-list .readmore', function () {
1219        $(this).toggleClass('collapsed');
1220        if ($(this).hasClass('collapsed')) {
1221            $(this).attr("aria-expanded", "false").text("Read less");
1222            $(this).parents(".common-content").find(".readmore_text").addClass("show-content");
1223        } else {
1224            $(this).attr("aria-expanded", "true").text("Read more");
1225            $(this).parents(".common-content").find(".readmore_text").removeClass("show-content");
1226        }
1227    });
1228    $(document).on('click', '.team-single .readmore', function () {
1229        $(this).toggleClass('collapsed');
1230        if ($(this).hasClass('collapsed')) {
1231            $(this).attr("aria-expanded", "false").text("Read less");
1232            $(this).parents(".team-single").find(".readmore_text").addClass("show-content");
1233            $(this).parents(".team-single").find(".less_text").addClass("hide-content");
1234        } else {
1235            $(this).attr("aria-expanded", "true").text("Read more");
1236            $(this).parents(".team-single").find(".readmore_text").removeClass("show-content");
1237            $(this).parents(".team-single").find(".less_text").removeClass("hide-content");
1238        }
1239    });
1240    $(document).on("click", "#pagination a", function () {
1241        var headerIn = $("header.header").height();
1242        var newsBtn = $(".scroll-to-listing").offset().top - headerIn;
1243        $('html,body').animate({
1244            scrollTop: newsBtn
1245        }, 'slow');
1246        $(this).removeClass("lst-pagination");
1247    });
1248    $(".two-column-content").each(function () {
1249        if (!$(this).find(".content-common").length) {
1250            $(this).addClass("remove-space");
1251        }
1252    });
1253
1254
1255
1256    if ($(window).width() <= 1200) {
1257        $(".same-page").each(function () {
1258            var sameIdMob = $(this).attr('href');
1259            $(this).on("click", function () {
1260                posId = $(sameIdMob).offset().top - 93;
1261                $('body,html').animate({
1262                    scrollTop: posId,
1263                }, 400);
1264                return false;
1265            })
1266        });
1267    }
1268    $(window).on('resize', function () {
1269        if ($(window).width() <= 1200) {
1270            $(".same-page").each(function () {
1271                var sameIdMob = $(this).attr('href');
1272                $(this).on("click", function () {
1273                    posId = $(sameIdMob).offset().top - 93;
1274                    $('body,html').animate({
1275                        scrollTop: posId,
1276                    }, 400);
1277                    return false;
1278                })
1279            });
1280        }
1281    })
1282
1283    $(".list-icons-four").each(function () {
1284        eligibleItems = $(this).find("li").length;
1285        if ($(this).find("li").length >= 6) {
1286            $(this).addClass("float-spacing");
1287        } else {
1288            $(this).addClass("flex-spacing")
1289        }
1290    })
1291    $(".gec-icons-four").each(function () {
1292        eligibleItems = $(this).find("li").length;
1293        if ($(this).find("li").length >= 4) {
1294            $(this).addClass("float-spacing");
1295        } else {
1296            $(this).addClass("flex-spacing")
1297        }
1298    })
1299
1300    $("html, body").keyup(function (e) {
1301        if (($(e.target).parents().hasClass('header-in'))) {
1302
1303        } else {
1304
1305            $(".mobile-search-menu").removeClass("is-open");
1306            $(".top-search-box").slideUp();
1307            $(".top-search-new  a, .top-search-new  button").removeClass("is-open");
1308        }
1309    });
1310    $("html, body").keyup(function (e) {
1311        if (($(e.target).parents().hasClass('mh-header'))) {
1312
1313        } else {
1314            $(".search-nav-wrap .mega-menu-wrap").slideUp();
1315            $('.hamburger-menu').removeClass('hbm-open');
1316        }
1317    });
1318
1319    $('#user_password').attr('placeholder', 'New Password');
1320    $('.sitemap-page .mega-menu-wrap, .footer-sitemap .menu').removeAttr('id');
1321    $('.header-sitemap, .footer-sitemap').addClass('is-active');
1322    if ($("body").find(".select-btn").length) {
1323        $('.select-btn').keydown(function (e) {
1324            if (e.which == 32) { // tab
1325                e.preventDefault();
1326                $(this).parent().find('.dropdown-toggle').click();
1327                $(this).parent().find('.dropdown-menu a:first').focus();
1328            }
1329        });
1330    }
1331
1332    $(".further-information-links").each(function () {
1333        var boxSize = $(this).find(".boxes-sizes").length;
1334
1335        $this = $(this);
1336        if (boxSize == 2) {
1337            $this.addClass('boxes-control');
1338        }
1339    })
1340    $(".case-study-length").each(function () {
1341        var boxSize = $(this).find(".case-study-single").length;
1342
1343        $this = $(this);
1344        if (boxSize == 1) {
1345            $this.addClass('boxes-control-2');
1346        } else if (boxSize == 2) {
1347            $this.addClass('boxes-control-2');
1348        } else if (boxSize == 3) {
1349            $this.addClass('boxes-control-3');
1350        } else {
1351
1352        }
1353    })
1354
1355    /* Accessibility  */
1356    $(document).on("keyup", ".future-tabs li a", function (e) {
1357        var element = $(this);
1358        if (e.keyCode == 37) {
1359            element.parents("li").prev().find("a").focus();
1360            $('.type').removeClass('active');
1361            element.parents("li").prev().find("a").click();
1362        }
1363        if (e.keyCode == 39) {
1364            element.parents("li").next().find("a").focus();
1365            $('.type').removeClass('active');
1366            element.parents("li").next().find("a").click();
1367        }
1368    })
1369    /* Accessibility  */
1370
1371    if ($("body").find(".login-bar-wrap").length) {
1372        var loginBar = $('.login-bar-wrap').height();
1373        //$('.login-bar-wrap').css('height', loginBar);
1374        var fixmeTop = $('.login-bar').offset().top;
1375        var headerHeight = $('.header').height();
1376        var fixmeTop2 = $('.login-bar').offset().top - headerHeight;
1377        $(window).scroll(function () {
1378            var newsHeight = $('.news-list-wrap').height() + fixmeTop + headerHeight;
1379            var currentScroll = $(window).scrollTop();
1380            if (currentScroll >= fixmeTop2 && currentScroll <= newsHeight) {
1381                $('.login-bar-wrap').addClass("login-bar-active");
1382                //$('.login-bar').css('top', headerHeight);
1383            } else {
1384                $('.login-bar-wrap').removeClass("login-bar-active");
1385                //$('.login-bar').css('top', '0');
1386            }
1387        });
1388    }
1389
1390    // CF7 - autocomplete
1391    if ($('.wpcf7-form .cf7-autocomplete').length) {
1392        $('.wpcf7-form input[name="first_name"]').change(function () {
1393            $('.wpcf7-form input[name="contact_first_name"]').val(this.value);
1394        });
1395        $('.wpcf7-form input[name="last_name"]').change(function () {
1396            $('.wpcf7-form input[name="contact_last_name"]').val(this.value);
1397        });
1398        $('.wpcf7-form input[name="email"]').change(function () {
1399            $('.wpcf7-form input[name="contact_email"]').val(this.value);
1400        });
1401    }
1402
1403    if ($('.wpcf7-form button[data-id="council_area"]').length) {
1404        $('.wpcf7-form button[data-id="council_area"]').attr('aria-label', 'Your Council Area');
1405    }
1406    if ($('.wpcf7-form [data-name=referring_organisation]').length) {
1407        $('.wpcf7-form [data-name=referring_organisation]').find('label').attr('aria-label', 'Referral on Someone else’s behalf');
1408        $('.wpcf7-form [data-name=referring_organisation]').find('.wpcf7-list-item-label').text("Referral on Someone else’s behalf");
1409    }
1410    if ($('.wpcf7-form [data-name=gdpr]').length) {
1411        $('.wpcf7-form [data-name=gdpr]').find('label').attr('aria-label', 'Contact Preference');
1412        $('.wpcf7-form [data-name=gdpr]').find('.wpcf7-list-item-label').text("Contact Preference");
1413    }
1414    if ($('.wpcf7-form [data-name=confirm]').length) {
1415        $('.wpcf7-form [data-name=confirm]').find('label').attr('aria-label', 'As the referrer I confirm');
1416        $('.wpcf7-form [data-name=confirm]').find('.wpcf7-list-item-label').text("As the referrer I confirm");
1417    }
1418
1419    if ($('a[href*=\\#future_bright_signup]').length) {
1420        $('a[href*=\\#future_bright_signup]').on("click", function () {
1421            $('form.wpcf7-form *:input[type!=hidden]:first').focus();
1422            console.log("input-focus");
1423        });
1424        $('a[href*=\\#future_bright_signup]').keydown(function (e) {
1425            if (e.which == 32) { // tab
1426                e.preventDefault();
1427                $('form.wpcf7-form *:input[type!=hidden]:first').focus();
1428            }
1429        });
1430    }
1431
1432    $(document).on('click', '.dropdown.bootstrap-select .select-btn', function () {
1433        $(this).next('.dropdown-menu').find('.dropdown-item').each(function () {
1434            var dropdown_item_text = $(this).text();
1435            // console.log(dropdown_item_text);
1436            $(this).attr('aria-label', dropdown_item_text);
1437        });
1438    });
1439
1440
1441
1442})(jQuery);
1443
1444
1445/*===================================================
1446                   Expert Partners slider
1447 ===================================================*/
1448
1449function expertSlider() {
1450    if (jQuery("body").find(".expert-slider").length) {
1451        jQuery('.expert-slider').each(function () {
1452            var $this = jQuery(this);
1453            var childCount = $this.find('.expert-slide-item').length;
1454            console.log(childCount);
1455
1456            // Attach init handler BEFORE slick() call
1457            // $this.on("init", function (event, slick) {
1458            //     $this.parents('.expert-partners').find(".content-image-count").html(
1459            //         '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
1460            //         (slick.currentSlide + 1) +
1461            //         '/<span class="sr-only" aria-label="Of">Of</span> ' +
1462            //         slick.slideCount
1463            //     );
1464            // });
1465            $this.on("init", function (event, slick) {
1466                setTimeout(function () {
1467                    var totalSlides = slick && slick.slideCount ? slick.slideCount : 0;
1468                    var currentSlide = slick && slick.currentSlide !== undefined ? slick.currentSlide + 1 : 1;
1469
1470                    $this.parents('.expert-partners').find(".content-image-count").html(
1471                        '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
1472                        currentSlide +
1473                        '/<span class="sr-only" aria-label="Of">Of</span> ' +
1474                        childCount
1475                    );
1476                }, 100);
1477            });
1478
1479            // Also attach afterChange BEFORE slick()
1480            $this.on("afterChange", function (event, slick, currentSlide) {
1481                $this.parents('.expert-partners').find(".content-image-count").html(
1482                    '<span class="sr-only" aria-label="Total slide out">Total slide out</span>' +
1483                    (currentSlide + 1) +
1484                    '/<span class="sr-only" aria-label="Of">Of</span>' +
1485                    slick.slideCount
1486                );
1487            });
1488
1489            $this.slick({
1490                dots: true,
1491                slidesToShow: 3,
1492                autoplay: false,
1493                arrows: true,
1494                dots: false,
1495                infinite: false,
1496                accessibility: true,
1497                prevArrow: $this.parents('.expert-partners').find('.dlv-prev'),
1498                nextArrow: $this.parents('.expert-partners').find('.dlv-next'),
1499                responsive: [
1500                    {
1501                        breakpoint: 767,
1502                        settings: {
1503                            slidesToShow: 2,
1504                            dots: false,
1505                            infinite: false,
1506                            arrows: false,
1507                            prevArrow: $this.parents('.expert-partners').find('.dlv-prev'),
1508                            nextArrow: $this.parents('.expert-partners').find('.dlv-next'),
1509                        }
1510                    },
1511                    {
1512                        breakpoint: 575,
1513                        settings: {
1514                            slidesToShow: 1,
1515                            dots: false,
1516                            infinite: false,
1517                            arrows: false,
1518                            prevArrow: $this.parents('.expert-partners').find('.dlv-prev'),
1519                            nextArrow: $this.parents('.expert-partners').find('.dlv-next'),
1520                        }
1521                    }
1522                ]
1523            });
1524        });
1525    }
1526}
1527jQuery(window).resize(function () {
1528    if (jQuery(window).width() < 767) {
1529        expertSlider();
1530    } else {
1531        if (jQuery("body").find(".expert-slider").length) {
1532            jQuery('.expert-slider').slick("unslick");
1533            jQuery('.expert-slider').unslick();
1534            jQuery('.expert-slider').off("init afterChange");
1535        }
1536    }
1537});
1538
1539
1540jQuery(document).ready(function () {
1541    if (jQuery(window).width() < 767) {
1542        setTimeout(function () {
1543            expertSlider();
1544        }, 100);
1545    }
1546
1547
1548    if (jQuery("body").find(".wpcf7").length) {
1549        var my_point = jQuery("div.my_point").offset().top;
1550        jQuery(".checkbox").on("click", function () {
1551            my_point = jQuery("div.my_point").offset().top;
1552        })
1553        var wpcf7Elm = document.querySelector('.wpcf7');
1554        wpcf7Elm.addEventListener('wpcf7submit', function (event) {
1555            jQuery('select').val('');
1556
1557
1558            jQuery('.selectpicker').selectpicker('refresh');
1559
1560            setTimeout(function () {
1561                my_point = jQuery("div.my_point").offset().top;
1562                jQuery('html, body').animate({
1563                    scrollTop: (my_point - 100)
1564                }, 1000)
1565            }, 700)
1566        }, false);
1567    }
1568
1569});
1570/* jQuery(function($) {
1571    jQuery(document).keyup(function(e) {
1572        console.log("DFdf");
1573        if (e.keyCode === 27) {
1574            console.log("222");
1575            jQuery('#mega-menu-primary').find('.mega-sub-menu').hideAllPanels();
1576            jQuery('.max-mega-menu').data('maxmegamenu').hideAllPanels();
1577        }
1578    });
1579}); */
1580jQuery(function ($) {
1581
1582    function toggleClear($input) {
1583        const $clear = $input.siblings('.search-clear');
1584        $clear.toggle($.trim($input.val()).length > 0);
1585    }
1586
1587    $('.search-clear').each(function () {
1588        toggleClear($(this).siblings('input[type="text"]'));
1589    });
1590
1591    $(document).on('input', 'input[type="text"]', function () {
1592        toggleClear($(this));
1593    });
1594
1595    $(document).on('click', '.search-clear', function () {
1596        const $input = $(this).siblings('input[type="text"]');
1597
1598        $input.val('').focus();
1599        $(this).hide();
1600
1601        // Optional: trigger your search suggestion logic if any
1602        $input.trigger('input');
1603    });
1604
1605});

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.