Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function($) {
- /********************
- Open all external links open in a new tab apart from a domain
- *********************/
- var all_links = document.querySelectorAll('#content a');
- for (var i = 0; i < all_links.length; i++){
- var a = all_links[i];
- if(a.hostname != location.hostname && a.hostname != "javascript:void(0)") {
- a.rel = 'noopener';
- a.target = '_blank';
- }
- }
- /*****************************
- ADA Compliance
- ******************************/
- var menuItems = document.querySelectorAll('.desktop-nav .menu li.menu-item-has-children, #top-navigation .menu li.menu-item-has-children');
- Array.prototype.forEach.call(menuItems, function(el, i){
- var activatingA = el.querySelector('a');
- var btn = '<button><span><span class="visuallyhidden">show submenu for “' + activatingA.text + '”</span></span></button>';
- activatingA.insertAdjacentHTML('afterend', btn);
- el.querySelector('button').addEventListener("click", function(event){
- if (this.parentNode.className == "menu-item-has-children") {
- this.parentNode.className = "menu-item-has-children open";
- this.parentNode.querySelector('a').setAttribute('aria-expanded', "true");
- this.parentNode.querySelector('button').setAttribute('aria-expanded', "true");
- } else {
- this.parentNode.className = "menu-item-has-children";
- this.parentNode.querySelector('a').setAttribute('aria-expanded', "false");
- this.parentNode.querySelector('button').setAttribute('aria-expanded', "false");
- }
- event.preventDefault();
- });
- });
- $(function() {
- $('.wpcf7-form-control-wrap').attr('role','none');
- $('.vc_tta-controls-icon').attr('role','none');
- $('.vc_empty_space_inner').attr('role','none');
- $('figure').attr('role','none');
- $('.menu .menu-item-has-children > a').attr('aria-haspopup','true');
- $('.menu .menu-item-has-children > a').attr('aria-expanded','false');
- $('#content .vc_btn3-container > a[target*="_blank"], a[target*="_blank"]').each(function(){
- var buttonTitle = $(this).attr('title');
- $(this).attr('aria-label', buttonTitle);
- // $("<span class='warning'>Open in new window</span>").appendTo(this);
- });
- $('.menu a[target*="_blank"]:not(".fa")').each(function(){
- var buttontext = $(this).text();
- $(this).attr('aria-label', buttontext + ' link will open in new tab or window');
- $(this).attr('role', 'button');
- });
- $('.menu a:not(".fa")').each(function(){
- var buttontext = $(this).text();
- $(this).attr('aria-label', 'View ' + buttontext);
- $(this).attr('role', 'button');
- });
- $('.gform_validation_errors').attr('role', 'alert');
- });
- /*****************************
- Hide Sub menu using ESC
- ******************************/
- $(document).ready(function() {
- $(document).keyup(function(e) {
- if (e.keyCode == 27) { // Esc keycode
- $('.sub-menu').hide();
- $('.sign-in-menu').hide();
- }
- });
- });
- /*****************************
- END ADA Compliance
- ******************************/
- $("#toTop a").click(function () {
- $("html, body").animate({scrollTop: 0}, 1000);
- });
- /*****************************
- Container Left/Right auto sizing
- ******************************/
- function LRContainerPadding() {
- const elementstyle = document.getElementById("main-container");
- const cssObjstyle = window.getComputedStyle(elementstyle, null);
- let marginLeft = cssObjstyle.getPropertyValue("margin-left");
- let marginRight = cssObjstyle.getPropertyValue("margin-right");
- if($(window).width() <= 1999) {
- $('.container_left').css('padding-left',marginLeft );
- $('.container_right').css('padding-right',marginRight );
- }
- }
- LRContainerPadding();
- $(document).ready(function() {
- LRContainerPadding();
- $(window).resize(function() {
- LRContainerPadding();
- });
- });
- /*****************************
- Header Height / mobile custom phone
- ******************************/
- function headerResizefunction() {
- var windowWidth = $(window).width();
- var headerHeight = $('.header_wrapper').outerHeight();
- var bannerHeight = $('.alert-modal').outerHeight();
- var wpadminbarOuterHeight = $('#wpadminbar').outerHeight();
- if ($('#wpadminbar').length){
- headerOffset = wpadminbarOuterHeight;
- } else {
- headerOffset = 0;
- }
- // if (windowWidth >= 1081) {
- // $('.header_wrapper').stickit({
- // screenMinWidth: 1081,
- // top: headerOffset
- // });
- // }
- $('.header_wrapper').css('top', headerOffset);
- // $('.close-alert').click(function(){
- // var mainNav = $('.main-header').outerHeight();
- // $('.header_wrapper').find('.alert-modal').hide();
- // $('.main-nav').css('top', headerHeight);
- // $('#content').css('margin-top', mainNav);
- // if($('.header_wrapper').hasClass('transparent_header')){
- // $('#content').css('margin-top', 0);
- // }
- // });
- if (windowWidth <= 1080) { // For MObile
- $('.header_wrapper').css('top', headerOffset);
- $('#content').css('margin-top',headerHeight);
- if ($('#wpadminbar').length){
- $('.main-nav').css('top', headerHeight + headerOffset);
- } else {
- $('.header_wrapper').css('top', 0);
- $('.main-nav').css('top', headerHeight - 1);
- }
- if ($('.vc_row.hero_section, .vc_section.hero_section').length) {
- $('.header_wrapper').addClass('transparent_header');
- $('#content').css('margin-top', headerHeight);
- } else {
- $('.header_wrapper').addClass('solid_header');
- $('#content').css('margin-top', headerHeight);
- }
- } else {
- if ($('.vc_row.hero_section, .vc_section.hero_section').length) {
- $('.header_wrapper').addClass('transparent_header');
- $('#content').css('margin-top', 0);
- } else {
- $('.header_wrapper').addClass('solid_header');
- $('#content').css('margin-top', headerHeight);
- }
- }
- }
- $(document).ready(function() {
- headerResizefunction();
- $(window).resize(function() {
- headerResizefunction();
- });
- });
- /********************
- Sticky Navs
- *********************/
- function stickyNavs() {
- var headerHeight = $('.header_wrapper').outerHeight();
- var wpadminbarOuterHeight = $('#wpadminbar').outerHeight();
- if ($('#wpadminbar').length){
- headerOffset = wpadminbarOuterHeight + headerHeight;
- } else {
- headerOffset = headerHeight;
- }
- // Site Navigator
- // $('.sticky_nav').stickit({
- // top: headerOffset,
- // scope: StickScope.Document,
- // });
- }
- stickyNavs();
- /*****************************
- Sticky Header
- ******************************/
- $(window).scroll(function() {
- var winTop = $(window).scrollTop();
- if (winTop >= 100) {
- $(".main-header").addClass("sticky");
- } else {
- $(".main-header").removeClass("sticky");
- }
- });
- var didScroll;
- // on scroll, let the interval function know the user has scrolled
- $(window).scroll(function(event){
- didScroll = true;
- });
- // run hasScrolled() and reset didScroll status
- setInterval(function() {
- if (didScroll) {
- hasScrolled();
- didScroll = false;
- }
- }, 250);
- function hasScrolled() {
- // do stuff here...
- }
- $(window).on("scroll", function() {
- didScroll = true;
- scrollTop = $(document).scrollTop();
- var windowWidth = $(window).width();
- if (windowWidth <= 1024) {
- var s = 190 - Math.min(190, scrollTop);
- } else {
- var s = 190 - Math.min(190, scrollTop);
- if (scrollTop === 0) {
- $(".light_logo").css('opacity',1);
- }
- }
- if( ($(".main-header").hasClass('sticky')) && ($(".main-header").hasClass('transparent_header'))) {
- } else {
- $(".light_logo").hide();
- $(".dark_logo").show();
- $(".dark_logo").css("opacity", $(window).scrollTop() / 150);
- $(".fake-bg").css("opacity", 0+ $(window).scrollTop() / 120);
- if (scrollTop === 0) {
- $(".dark_logo").hide();
- $(".light_logo").show();
- }
- }
- });
- // Scroll Position
- var didScroll;
- var lastScrollTop = 0;
- var delta = 5;
- var navbarHeight = $('header').outerHeight();
- $(window).scroll(function(event){
- didScroll = true;
- });
- setInterval(function() {
- if (didScroll) {
- hasScrolled();
- didScroll = false;
- }
- }, 250);
- function hasScrolled() {
- var st = $(this).scrollTop();
- var banner_exist = $(".have-slider-banner").length;
- if(banner_exist > 0) {
- if(Math.abs(lastScrollTop - st) <= delta)
- return;
- if (st > lastScrollTop && st > navbarHeight){
- // Scroll Down
- $('header').addClass('sticky');
- } else {
- // Scroll Up
- if(st + $(window).height() < $(document).height()) {
- //$('header').removeClass('sticky');
- }
- if(st == 0) {
- $('header').removeClass('sticky');
- }
- }
- }
- lastScrollTop = st;
- }
- // mobile menu dropdown & sticky header condition for without slider/banner page
- jQuery(document).ready(function() {
- if ($(window).width() < 991) {
- $('#navigation ul.menu > li.menu-item-has-children').click(function() {
- $('> ul', this).slideToggle(200);
- });
- }
- });
- /*****************************
- Custom Accordion
- ******************************/
- $(function() {
- $('.custom_accordion .accordion_wrapper').each(function(index){
- $(this).find('.accordion_title').attr("data-id", index);
- if(index === 0) {
- $(this).addClass('active');
- }
- });
- $('.acc_subcontent').each(function(index){
- $(this).attr("id", index);
- if(index === 0) {
- $(this).addClass('active');
- }
- mainAcc = $('.custom_accordion .accordion_wrapper .accordion_title[data-id=' + index + ']').parent().find(".accordion_inner");
- $(this).clone().appendTo(mainAcc);
- });
- $('.custom_accordion .accordion_wrapper .accordion_title').on('click', function () {
- if ($(this).parent().hasClass('active')) {
- $(this).parent().removeClass('active');
- } else {
- $('.custom_accordion .accordion_wrapper .accordion_inner').hide();
- $('.custom_accordion .accordion_wrapper').removeClass('active');
- $(this).parent().addClass('active');
- $('.custom_accordion .accordion_wrapper.active .accordion_inner').slideToggle();
- }
- });
- $(".accordion_title").click(function() {
- if ($(".accordion_wrapper").hasClass("active") == true) {
- $('.acc_subcontent:visible').hide();
- console.log($(this).data("id"));
- $('.acc_subcontent[id=' + $(this).data("id") + ']').delay(300).fadeIn();
- } else {
- $('.acc_subcontent:visible').hide();
- }
- });
- });
- // Custom Tabs With arrows
- // $(function() {
- // $('.tab-prev').click(function() {
- // if ($('.vc_tta-panels .vc_tta-panel.vc_active').prev().length != 0) {
- // $('.vc_tta-panels .vc_tta-panel.vc_active').removeClass('vc_active').prev().addClass('vc_active').click();
- // $('.vc_tta-tabs-list .vc_tta-tab.vc_active').removeClass('vc_active').prev().addClass('vc_active').click();
- // }
- // });
- // $('.tab-next').click(function() {
- // if ($('.vc_tta-panels .vc_tta-panel.vc_active').next().length != 0) {
- // $('.vc_tta-panels .vc_tta-panel.vc_active').removeClass('vc_active').next().addClass('vc_active').click();
- // $('.vc_tta-tabs-list .vc_tta-tab.vc_active').removeClass('vc_active').next().addClass('vc_active').click();
- // }
- // });
- // });
- /*****************************
- Modal
- ******************************/
- $(function() {
- $('.members_modal').appendTo('footer.footer');
- $('.search_modal').appendTo('.search_modal_footer');
- jQuery("div[id^='modal']").each(function(){
- var currentModal = jQuery(this);
- //click next
- currentModal.find('.btn-next').click(function(){
- currentModal.modal('hide');
- currentModal.closest("div[id^='modal']").nextAll("div[id^='modal']").first().modal('show');
- });
- //click prev
- currentModal.find('.btn-prev').click(function(){
- currentModal.modal('hide');
- currentModal.closest("div[id^='modal']").prevAll("div[id^='modal']").first().modal('show');
- });
- });
- });
- /********************
- Team Filter
- *********************/
- jQuery(function() {
- jQuery('.team_filter .searchandfilter > ul li').each(function(){
- var filterHeading = jQuery(this).find("h4");
- var activefilter = jQuery(this).find('li.sf-option-active label').text();
- filterHeading.toggleClass("active");
- filterHeading.text(activefilter);
- jQuery(this).find("h4").click(function(e) {
- e.preventDefault();
- jQuery(this).toggleClass('active');
- jQuery(this).siblings('ul').toggleClass("show_filter");
- jQuery(this).parent().siblings().find("h4").removeClass("active");
- return true;
- });
- });
- jQuery(document).mouseup(function(e){
- var container = jQuery(".team_filter .searchandfilter");
- // If the target of the click isn't the container
- if(!container.is(e.target) && container.has(e.target).length === 0){
- jQuery(".team_filter .searchandfilter ul li ul.show_filter").toggleClass('show_filter');
- }
- });
- });
- /********************
- Resources Filter
- *********************/
- jQuery(function() {
- jQuery('.resources_filter .searchandfilter > ul > li').each(function(){
- var resourceFilterHeading = jQuery(this).find("h4");
- var resourceActivefilter = jQuery(this).find('li.sf-option-active label').text();
- resourceFilterHeading.toggleClass("active");
- resourceFilterHeading.text(resourceActivefilter);
- resourceFilterHeading.click(function(e) {
- e.preventDefault();
- jQuery(this).toggleClass('active');
- jQuery(this).siblings('ul').toggleClass("show_filter");
- jQuery(this).parent().siblings().find("h4").removeClass("active");
- return true;
- });
- });
- jQuery(document).mouseup(function(e){
- var container = jQuery(".resources_filter .searchandfilter");
- // If the target of the click isn't the container
- if(!container.is(e.target) && container.has(e.target).length === 0){
- jQuery(".resources_filter .searchandfilter ul li ul.show_filter").toggleClass('show_filter');
- }
- });
- });
- /*****************************
- Mobile Page Menu
- ******************************/
- $(function() {
- var windowWidth = $(window).width();
- if (windowWidth <= 767) {
- $('.page_menu .widget_nav_menu').prepend("<a class='open-page-menu'>Open Menu</a>");
- var pageMenuActive = $('.page_menu .widget_nav_menu').find('.current_page_item a').text();
- $('.open-page-menu').text(pageMenuActive);
- $('.open-page-menu').click(function(){
- $(this).next('div').slideToggle();
- });
- }
- });
- // $(function() {
- // $(document).ready(function() {
- // $('.disable_link a.mega-menu-link').click(function(e){
- // e.preventDefault();
- // });
- // });
- // });
- /********************
- Case Study Widget Carousel
- *********************/
- $(function() {
- var windowWidth = $(window).width();
- $('.testimonial_blocks .slide-for').slick({
- respondTo: 'slider',
- adaptiveHeight: true,
- infinite: true,
- autoplay: true,
- autoplaySpeed: 4000,
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: false,
- dots: false,
- fade: true,
- asNavFor: '.testimonial_blocks .slide-nav',
- swipe: false,
- swipeToSlide: false,
- draggable: false,
- //variableWidth: true
- responsive: [
- {
- breakpoint: 1024,
- settings: {
- dots: true
- }
- },
- ]
- });
- $('.testimonial_blocks .slide-nav').slick({
- respondTo: 'slider',
- adaptiveHeight: true,
- dots: false,
- arrows: false,
- infinite: false,
- // autoplay: true,
- autoplaySpeed: 3000,
- slidesToShow: 5,
- slidesToScroll: 1,
- asNavFor: '.testimonial_blocks .slide-for',
- centerMode: false,
- centerPadding: '0',
- focusOnSelect: true,
- //variableWidth: true
- responsive: [
- {
- breakpoint: 1024,
- settings: {
- slidesToShow:4,
- slidesToScroll: 1,
- }
- },
- {
- breakpoint: 768,
- settings: {
- slidesToShow:2,
- slidesToScroll: 2,
- }
- },
- {
- breakpoint: 767,
- settings: {
- slidesToShow:1,
- slidesToScroll: 1,
- }
- },
- ]
- });
- $page_info = $('.resource_slider__info');
- $resource_num = $('.resource_slider__num');
- $resource_slider = $('.resource_slider .slide-for');
- $resource_slider_nav = $('.resource_slider .slide-nav');
- $slide_info = $('.resource_slider__meta');
- $resource_slider.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
- var i = (currentSlide ? currentSlide : 0) + 1;
- $page_info.text(i + '|' + slick.slideCount);
- $('.resource_slider .slide-nav.slick-slide').each(function(i,v){
- console.log($(i))
- });
- });
- $resource_slider_nav.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
- $(this).find('.slick-slide').each(function(i,v){
- $(v).find('.resource_slider__num').text(i + 1 + '. ')
- });
- });
- $('.resource_slider .slide-for').slick({
- respondTo: 'slider',
- infinite: true,
- // autoplay: true,
- autoplaySpeed: 5000,
- adaptiveHeight: true,
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: true,
- dots: false,
- asNavFor: '.resource_slider .slide-nav',
- swipe: true,
- swipeToSlide: true,
- draggable: true,
- prevArrow: $('.resource_slider__arrow .prev'),
- nextArrow: $('.resource_slider__arrow .next'),
- });
- $('.resource_slider .slide-nav').slick({
- dots: false,
- arrows: false,
- infinite: true,
- autoplaySpeed: 5000,
- slidesToShow: 3,
- slidesToScroll: 1,
- centerMode: true,
- centerPadding: '0',
- focusOnSelect: true,
- responsive: [
- {
- breakpoint: 1024,
- settings: {
- slidesToShow:2,
- slidesToScroll: 1,
- }
- },
- {
- breakpoint: 767,
- settings: {
- slidesToShow:1,
- slidesToScroll: 1,
- }
- },
- ]
- });
- });
- /********************
- Locations Carousel
- *********************/
- $(function() {
- var windowWidth = $(window).width();
- $('.locations_carousel .slide-for').slick({
- respondTo: 'slider',
- adaptiveHeight: true,
- infinite: true,
- autoplay: false,
- speed: 500,
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: false,
- dots: false,
- fade: true,
- asNavFor: '.locations_carousel .slide-nav',
- swipe: false,
- swipeToSlide: false,
- draggable: false,
- //variableWidth: true
- });
- $('.locations_carousel .slide-nav').slick({
- respondTo: 'slider',
- adaptiveHeight: true,
- dots: false,
- arrows: false,
- infinite: false,
- autoplay: false,
- speed: 500,
- slidesToShow: 3,
- slidesToScroll: 1,
- asNavFor: '.locations_carousel .slide-for',
- centerMode: false,
- centerPadding: '0',
- focusOnSelect: true,
- //variableWidth: true
- responsive: [
- {
- breakpoint: 1024,
- settings: {
- slidesToShow:3,
- slidesToScroll: 1,
- }
- },
- {
- breakpoint: 768,
- settings: {
- slidesToShow:2,
- slidesToScroll: 2,
- }
- },
- {
- breakpoint: 767,
- settings: {
- slidesToShow:1,
- slidesToScroll: 1,
- }
- },
- ]
- });
- });
- /********************
- Boxes Carousel
- *********************/
- $(function() {
- $(".boxes_carousel").not('.slick-initialized').slick({
- dots:true,
- appendDots: $('.boxes_dots'),
- respondTo: 'slider',
- adaptiveHeight: true,
- infinite: false,
- autoplay: false,
- speed: 500,
- slidesToShow: 2,
- slidesToScroll: 1,
- arrows: true,
- prevArrow: $('.boxes_arrows .boxes-prev'),
- nextArrow: $('.boxes_arrows .boxes-next'),
- responsive: [
- {
- breakpoint: 767,
- settings: {
- slidesToShow:1,
- slidesToScroll: 1,
- }
- },
- ]
- });
- });
- /********************
- Teams Carousel
- *********************/
- $(function() {
- $(".teams_carousel").not('.slick-initialized').slick({
- dots:true,
- appendDots: $('.teams_dots'),
- respondTo: 'slider',
- adaptiveHeight: true,
- infinite: false,
- autoplay: false,
- speed: 500,
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: true,
- prevArrow: $('.teams_arrows .teams-prev'),
- nextArrow: $('.teams_arrows .teams-next'),
- });
- });
- $(function() {
- $('.gallery-slider').not('.slick-initialized').slick({
- infinite: true,
- slidesToShow: 2,
- slidesToScroll: 1,
- autoplay: true,
- autoplaySpeed: 0,
- speed: 6000,
- cssEase: "linear",
- pauseOnHover: false,
- arrows: false,
- dots:false,
- responsive: [
- {
- breakpoint: 992,
- settings: {
- slidesToShow:2,
- slidesToScroll: 1,
- autoplay: true,
- autoplaySpeed: 0,
- pauseOnHover: true,
- }
- },
- {
- breakpoint: 767,
- settings: {
- slidesToShow: 1,
- slidesToScroll: 1,
- autoplay: true,
- autoplaySpeed: 0,
- pauseOnHover: true,
- }
- }]
- });
- });
- // Awards Logo
- $(function() {
- $('.awards_grid').not('.slick-initialized').slick({
- slidesToShow: 5,
- slidesToScroll: 5,
- arrows: false,
- dots: false,
- responsive: [
- {
- breakpoint: 767,
- settings: {
- slidesToShow: 2,
- slidesToScroll: 1,
- }
- }]
- });
- });
- // Partners Logo
- $(function() {
- $('.partners_grid').not('.slick-initialized').slick({
- slidesToShow: 6,
- slidesToScroll: 6,
- arrows: false,
- dots: false,
- responsive: [
- {
- breakpoint: 767,
- settings: {
- slidesToShow: 2,
- slidesToScroll: 1,
- }
- }]
- });
- });
- // $(function() {
- // $('.project_gallery ul').not('.slick-initialized').slick({
- // slidesToShow: 1,
- // slidesToScroll: 1,
- // arrows: false,
- // dots: false,
- // fade: false,
- // });
- // });
- $(function() {
- var windowWidth = $(window).width();
- // Tablet
- if(windowWidth <= 1024) {
- $('.hero_images__overlay .wpb_wrapper').not('.slick-initialized').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: false,
- dots: false
- });
- }
- // Mobile
- if (windowWidth <= 767) {
- // var divs = $(".post_list > .post_item");
- // for(var i = 0; i < divs.length; i+=3) {
- // divs.slice(i, i+3).wrapAll("<div class='posts_carousel'></div>");
- // }
- // $('.post_list .posts_carousel').not('.slick-initialized').slick({
- // slidesToShow: 1,
- // slidesToScroll: 1,
- // arrows: false,
- // dots: true,
- // fade: false,
- // adaptiveHeight: true
- // });
- $('.custom_accordion .vc_tta-panels, .mobile_slider').not('.slick-initialized').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- autoplay: true,
- autoplaySpeed: 4000,
- arrows: false,
- dots: true
- });
- }
- });
- /*****************************
- Mobile Tabs
- ******************************/
- // $(function() {
- // var windowWidth = $(window).width();
- // if (windowWidth <= 767) {
- // $('.tabs_section .vc_tta-tabs-container').prepend("<a class='open-tab'>Open Tab</a>");
- // var tabActive = $('.tabs_section .vc_tta-tabs-container').find('.vc_active').text();
- // $('.open-tab').text(tabActive);
- // $('.open-tab').click(function(){
- // $(this).next('ul').slideToggle();
- // });
- // $('.tabs_section .vc_tta-tabs-container li').click(function(){
- // $(this).parent().slideToggle();
- // var currentTab = $(this).find('span').text();
- // $('.open-tab').text(currentTab);
- // });
- // }
- // });
- /*****************************
- Graphs / Charts / Odometer
- ******************************/
- $(function() {
- $('.counter').countUp({
- 'time': 2000,
- 'delay': 30
- });
- });
- $(function() {
- var waypoints = $('.vc_section.terms').waypoint({
- handler: function(direction) {
- $(this).toggleClass('active_view')
- },
- offset: '50%'
- });
- });
- /********************
- Mobile tabs
- *********************/
- $(function() {
- var windowWidth = $(window).width();
- if (windowWidth <= 767) {
- $(window).load(function(){
- var activeloadedText= $('.vc_tta-tab.vc_active > a .vc_tta-title-text').text();
- $('.mobile_tab_menu').text(activeloadedText);
- });
- $(".vertical_tabs").each(function(){
- var mobileMenu = $(this).find('.mobile_tab_menu');
- var tabItem = $(this).find('.vc_tta-tab > a');
- var activeText = $(this).find(".vc_tta-tab.vc_active .vc_tta-title-text").text();
- mobileMenu.text(activeText);
- mobileMenu.click(function(e){
- e.preventDefault();
- $(this).toggleClass("active");
- $(this).parent().find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').toggleClass("show");
- });
- $('.footer-col a').click(function(e){
- var activeClickedtextonPage = $(this).text();
- mobileMenu.text(activeClickedtextonPage);
- $('body').find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').removeClass("show");
- mobileMenu.removeClass("active");
- });
- tabItem.click(function(e){
- var activeClickedtext = $(this).find('.vc_tta-title-text').text();
- mobileMenu.text(activeClickedtext);
- e.preventDefault();
- $(this).parents().find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').removeClass("show");
- mobileMenu.removeClass("active");
- });
- });
- }
- });
- /********************
- Mobile VC ROW Swap
- *********************/
- $(function() {
- var windowWidth = $(window).width();
- if (windowWidth <= 767) {
- $('.vc_row.mobile_swap').wrapAll('<div class="mobile_swap_wrapper" />');
- }
- });
- $(document).ready(function() {
- var bodyToggle = $('body');
- $('.mobile-toggle-wrap').click(function() {
- bodyToggle.toggleClass('collapse_menu');
- });
- function mobile_navigation() {
- var windowWidth_1024px = $(window).width();
- if (windowWidth_1024px <= 1279) {
- // Second Level
- $('#mobile-menu li.menu-item-has-children').each(function(el) {
- $(this).prepend("<a class='open-menu'></a>");
- });
- $('#mobile-menu li.menu-item-has-children:has(ul)').addClass("inactive");
- $('#mobile-menu li.menu-item-has-children:has(ul) ul').css('display', 'none');
- $('.open-menu').click(function() {
- if ($(this).closest('li.menu-item-has-children').hasClass('active')){
- $(this + 'a').attr('aria-expanded','false');
- }
- if ($(this).closest('li.menu-item-has-children').hasClass('inactive')){
- $(this + 'a').attr('aria-expanded','true');
- }
- var checkElement = $(this).next().next();
- $(this).parent('li.menu-item-has-children ').removeClass('active');
- $(this).parent('li.menu-item-has-children').addClass('active').removeClass("inactive");
- if ((checkElement.is('ul')) && (checkElement.is(':visible'))) {
- console.log
- $(this).parent().siblings('li.menu-item-has-children').removeClass('active').addClass('inactive');
- checkElement.slideUp('normal');
- }
- if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
- $('ul ul:visible').not($(this).closest('ul')).slideUp('normal');
- checkElement.slideDown('normal');
- }
- if (checkElement.is('ul')) {
- return false;
- } else {
- return true;
- }
- });
- // END Third Level Dropdown
- }
- }
- mobile_navigation();
- });
- $('a[href^="#"].scrollTo, .scrollTo a[href^="#"], .scrollTo a').click(function()
- {
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
- || location.hostname == this.hostname)
- {
- var target = $(this.hash),
- headerHeight = $('.header_wrapper').outerHeight(),
- stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
- target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
- headerOffset = headerHeight + stickyNav;
- headerOffset = headerOffset + 60;
- if (target.length)
- {
- $('html,body').animate({
- scrollTop: target.offset().top - headerOffset
- }, 500);
- return false;
- }
- }
- });
- // Site Navigator
- $('#navigation a[href^="#"].scrollNav, #navigation .scrollNav a[href^="#"], #navigation .scrollNav a').click(function()
- {
- var bodyToggle = $('body');
- bodyToggle.toggleClass('collapse_menu');
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
- || location.hostname == this.hostname)
- {
- var target = $(this.hash),
- headerHeight = $('.header_wrapper').outerHeight(),
- stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
- target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
- headerOffset = headerHeight + stickyNav;
- headerOffset = headerOffset + 60;
- if (target.length)
- {
- $('html,body').animate({
- scrollTop: target.offset().top - headerOffset
- }, 1000, 'swing');
- return false;
- }
- }
- });
- // to top right away
- if ( window.location.hash ) scroll(0,0);
- // void some browsers issue
- setTimeout( function() { scroll(0,0); }, 1);
- $(function() {
- headerHeight = $('.header_wrapper').outerHeight(),
- stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
- headerOffset = headerHeight + stickyNav;
- scrollPadding = $('.vc_tta-tabs').length ? 120 : 0
- setTimeout(function() {
- // *only* if we have anchor on the url
- if(window.location.hash) {
- // smooth scroll to the anchor id
- $('html, body').animate({
- scrollTop: $(window.location.hash).offset().top - headerOffset - scrollPadding
- }, 1000, 'swing');
- }
- }, 1000);
- });
- function removeBR() {
- if ($(window).width() <= 1080) {
- $('.banner h4 br').remove();
- $('.vc_custom_heading br').remove();
- $('.hero_section p br').remove();
- $('.wpb_text_column:not(.contact_details) p br').remove();
- $('.sub_content br').remove();
- $('.scrollToNav h6 br').remove();
- }
- $('.details_content p:empty').remove();
- }
- $(window).resize(removeBR);
- $(window).load(removeBR);
- $(document).ready(removeBR);
- $(function() {
- let accordionTarget = document.querySelectorAll('.custom_accordion__target > div')
- let accordionToggle = document.querySelectorAll('.vc_tta-panels .vc_tta-panel')
- let accordionRowTarget = document.querySelectorAll('.custom_accordion__row .vc_row')
- let accordionRowToggle = document.querySelectorAll('.custom_boxes .box_wrap')
- function initAccordionTarget(target, trigger) {
- if(target.length > 1) {
- target[0].classList.add('active')
- trigger.forEach(function(e, i) {
- e.addEventListener('click', function() {
- triggerTarget(target, i)
- })
- })
- }
- }
- function triggerTarget(elem, i) {
- elem.forEach(function(j) {
- if(j.classList.contains('active')) {
- j.classList.remove('active')
- }
- })
- elem[i].classList.add('active')
- }
- initAccordionTarget(accordionTarget, accordionToggle)
- initAccordionTarget(accordionRowTarget, accordionRowToggle)
- $('.custom_accordion .vc_tta-panels').on('beforeChange', function(event, slick, currentSlide, nextSlide){
- if(accordionTarget.length > 0)
- triggerTarget(accordionTarget, nextSlide)
- });
- $('.custom_boxes').on('beforeChange', function(event, slick, currentSlide, nextSlide){
- if(accordionRowTarget.length > 0) {
- triggerTarget(accordionRowTarget, currentSlide)
- }
- });
- })
- })($);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement