Advertisement
MikkoDC

Untitled

Mar 4th, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.36 KB | None | 0 0
  1. (function($) {
  2.  
  3. /********************
  4. Open all external links open in a new tab apart from a domain
  5. *********************/
  6. var all_links = document.querySelectorAll('#content a');
  7. for (var i = 0; i < all_links.length; i++){
  8. var a = all_links[i];
  9. if(a.hostname != location.hostname && a.hostname != "javascript:void(0)") {
  10. a.rel = 'noopener';
  11. a.target = '_blank';
  12. }
  13. }
  14.  
  15.  
  16. /*****************************
  17. ADA Compliance
  18. ******************************/
  19.  
  20. var menuItems = document.querySelectorAll('.desktop-nav .menu li.menu-item-has-children, #top-navigation .menu li.menu-item-has-children');
  21. Array.prototype.forEach.call(menuItems, function(el, i){
  22. var activatingA = el.querySelector('a');
  23. var btn = '<button><span><span class="visuallyhidden">show submenu for “' + activatingA.text + '”</span></span></button>';
  24. activatingA.insertAdjacentHTML('afterend', btn);
  25.  
  26. el.querySelector('button').addEventListener("click", function(event){
  27. if (this.parentNode.className == "menu-item-has-children") {
  28. this.parentNode.className = "menu-item-has-children open";
  29. this.parentNode.querySelector('a').setAttribute('aria-expanded', "true");
  30. this.parentNode.querySelector('button').setAttribute('aria-expanded', "true");
  31. } else {
  32. this.parentNode.className = "menu-item-has-children";
  33. this.parentNode.querySelector('a').setAttribute('aria-expanded', "false");
  34. this.parentNode.querySelector('button').setAttribute('aria-expanded', "false");
  35. }
  36. event.preventDefault();
  37. });
  38. });
  39.  
  40. $(function() {
  41. $('.wpcf7-form-control-wrap').attr('role','none');
  42. $('.vc_tta-controls-icon').attr('role','none');
  43. $('.vc_empty_space_inner').attr('role','none');
  44. $('figure').attr('role','none');
  45. $('.menu .menu-item-has-children > a').attr('aria-haspopup','true');
  46. $('.menu .menu-item-has-children > a').attr('aria-expanded','false');
  47.  
  48. $('#content .vc_btn3-container > a[target*="_blank"], a[target*="_blank"]').each(function(){
  49. var buttonTitle = $(this).attr('title');
  50. $(this).attr('aria-label', buttonTitle);
  51. // $("<span class='warning'>Open in new window</span>").appendTo(this);
  52. });
  53.  
  54. $('.menu a[target*="_blank"]:not(".fa")').each(function(){
  55. var buttontext = $(this).text();
  56. $(this).attr('aria-label', buttontext + ' link will open in new tab or window');
  57. $(this).attr('role', 'button');
  58. });
  59.  
  60. $('.menu a:not(".fa")').each(function(){
  61. var buttontext = $(this).text();
  62. $(this).attr('aria-label', 'View ' + buttontext);
  63. $(this).attr('role', 'button');
  64. });
  65.  
  66. $('.gform_validation_errors').attr('role', 'alert');
  67.  
  68. });
  69.  
  70. /*****************************
  71. Hide Sub menu using ESC
  72. ******************************/
  73. $(document).ready(function() {
  74. $(document).keyup(function(e) {
  75. if (e.keyCode == 27) { // Esc keycode
  76. $('.sub-menu').hide();
  77. $('.sign-in-menu').hide();
  78. }
  79. });
  80. });
  81.  
  82. /*****************************
  83. END ADA Compliance
  84. ******************************/
  85.  
  86. $("#toTop a").click(function () {
  87. $("html, body").animate({scrollTop: 0}, 1000);
  88. });
  89.  
  90. /*****************************
  91. Container Left/Right auto sizing
  92. ******************************/
  93. function LRContainerPadding() {
  94. const elementstyle = document.getElementById("main-container");
  95. const cssObjstyle = window.getComputedStyle(elementstyle, null);
  96. let marginLeft = cssObjstyle.getPropertyValue("margin-left");
  97. let marginRight = cssObjstyle.getPropertyValue("margin-right");
  98.  
  99. if($(window).width() <= 1999) {
  100. $('.container_left').css('padding-left',marginLeft );
  101. $('.container_right').css('padding-right',marginRight );
  102. }
  103. }
  104.  
  105. LRContainerPadding();
  106.  
  107. $(document).ready(function() {
  108. LRContainerPadding();
  109. $(window).resize(function() {
  110. LRContainerPadding();
  111. });
  112. });
  113.  
  114.  
  115. /*****************************
  116. Header Height / mobile custom phone
  117. ******************************/
  118. function headerResizefunction() {
  119. var windowWidth = $(window).width();
  120. var headerHeight = $('.header_wrapper').outerHeight();
  121. var bannerHeight = $('.alert-modal').outerHeight();
  122. var wpadminbarOuterHeight = $('#wpadminbar').outerHeight();
  123.  
  124. if ($('#wpadminbar').length){
  125. headerOffset = wpadminbarOuterHeight;
  126. } else {
  127. headerOffset = 0;
  128. }
  129. // if (windowWidth >= 1081) {
  130. // $('.header_wrapper').stickit({
  131. // screenMinWidth: 1081,
  132. // top: headerOffset
  133. // });
  134. // }
  135.  
  136. $('.header_wrapper').css('top', headerOffset);
  137.  
  138. // $('.close-alert').click(function(){
  139. // var mainNav = $('.main-header').outerHeight();
  140. // $('.header_wrapper').find('.alert-modal').hide();
  141. // $('.main-nav').css('top', headerHeight);
  142. // $('#content').css('margin-top', mainNav);
  143.  
  144. // if($('.header_wrapper').hasClass('transparent_header')){
  145. // $('#content').css('margin-top', 0);
  146. // }
  147. // });
  148.  
  149.  
  150. if (windowWidth <= 1080) { // For MObile
  151.  
  152.  
  153. $('.header_wrapper').css('top', headerOffset);
  154. $('#content').css('margin-top',headerHeight);
  155.  
  156. if ($('#wpadminbar').length){
  157. $('.main-nav').css('top', headerHeight + headerOffset);
  158. } else {
  159. $('.header_wrapper').css('top', 0);
  160. $('.main-nav').css('top', headerHeight - 1);
  161. }
  162.  
  163. if ($('.vc_row.hero_section, .vc_section.hero_section').length) {
  164. $('.header_wrapper').addClass('transparent_header');
  165. $('#content').css('margin-top', headerHeight);
  166. } else {
  167. $('.header_wrapper').addClass('solid_header');
  168. $('#content').css('margin-top', headerHeight);
  169. }
  170.  
  171. } else {
  172. if ($('.vc_row.hero_section, .vc_section.hero_section').length) {
  173. $('.header_wrapper').addClass('transparent_header');
  174. $('#content').css('margin-top', 0);
  175. } else {
  176. $('.header_wrapper').addClass('solid_header');
  177. $('#content').css('margin-top', headerHeight);
  178. }
  179. }
  180.  
  181. }
  182.  
  183. $(document).ready(function() {
  184. headerResizefunction();
  185. $(window).resize(function() {
  186. headerResizefunction();
  187. });
  188. });
  189.  
  190.  
  191.  
  192. /********************
  193. Sticky Navs
  194. *********************/
  195. function stickyNavs() {
  196. var headerHeight = $('.header_wrapper').outerHeight();
  197. var wpadminbarOuterHeight = $('#wpadminbar').outerHeight();
  198.  
  199. if ($('#wpadminbar').length){
  200. headerOffset = wpadminbarOuterHeight + headerHeight;
  201. } else {
  202. headerOffset = headerHeight;
  203. }
  204.  
  205. // Site Navigator
  206. // $('.sticky_nav').stickit({
  207. // top: headerOffset,
  208. // scope: StickScope.Document,
  209. // });
  210. }
  211.  
  212. stickyNavs();
  213.  
  214.  
  215. /*****************************
  216. Sticky Header
  217. ******************************/
  218. $(window).scroll(function() {
  219. var winTop = $(window).scrollTop();
  220. if (winTop >= 100) {
  221. $(".main-header").addClass("sticky");
  222. } else {
  223. $(".main-header").removeClass("sticky");
  224. }
  225. });
  226. var didScroll;
  227. // on scroll, let the interval function know the user has scrolled
  228. $(window).scroll(function(event){
  229. didScroll = true;
  230. });
  231. // run hasScrolled() and reset didScroll status
  232. setInterval(function() {
  233. if (didScroll) {
  234. hasScrolled();
  235. didScroll = false;
  236. }
  237. }, 250);
  238. function hasScrolled() {
  239. // do stuff here...
  240. }
  241. $(window).on("scroll", function() {
  242. didScroll = true;
  243. scrollTop = $(document).scrollTop();
  244. var windowWidth = $(window).width();
  245.  
  246. if (windowWidth <= 1024) {
  247. var s = 190 - Math.min(190, scrollTop);
  248. } else {
  249. var s = 190 - Math.min(190, scrollTop);
  250.  
  251. if (scrollTop === 0) {
  252. $(".light_logo").css('opacity',1);
  253. }
  254.  
  255. }
  256.  
  257. if( ($(".main-header").hasClass('sticky')) && ($(".main-header").hasClass('transparent_header'))) {
  258.  
  259. } else {
  260.  
  261. $(".light_logo").hide();
  262. $(".dark_logo").show();
  263. $(".dark_logo").css("opacity", $(window).scrollTop() / 150);
  264. $(".fake-bg").css("opacity", 0+ $(window).scrollTop() / 120);
  265.  
  266. if (scrollTop === 0) {
  267. $(".dark_logo").hide();
  268. $(".light_logo").show();
  269. }
  270. }
  271.  
  272. });
  273.  
  274. // Scroll Position
  275. var didScroll;
  276. var lastScrollTop = 0;
  277. var delta = 5;
  278. var navbarHeight = $('header').outerHeight();
  279.  
  280. $(window).scroll(function(event){
  281. didScroll = true;
  282. });
  283.  
  284. setInterval(function() {
  285. if (didScroll) {
  286. hasScrolled();
  287. didScroll = false;
  288. }
  289. }, 250);
  290.  
  291. function hasScrolled() {
  292. var st = $(this).scrollTop();
  293. var banner_exist = $(".have-slider-banner").length;
  294. if(banner_exist > 0) {
  295. if(Math.abs(lastScrollTop - st) <= delta)
  296. return;
  297. if (st > lastScrollTop && st > navbarHeight){
  298. // Scroll Down
  299. $('header').addClass('sticky');
  300. } else {
  301. // Scroll Up
  302. if(st + $(window).height() < $(document).height()) {
  303. //$('header').removeClass('sticky');
  304. }
  305. if(st == 0) {
  306. $('header').removeClass('sticky');
  307. }
  308. }
  309. }
  310. lastScrollTop = st;
  311. }
  312.  
  313. // mobile menu dropdown & sticky header condition for without slider/banner page
  314. jQuery(document).ready(function() {
  315. if ($(window).width() < 991) {
  316. $('#navigation ul.menu > li.menu-item-has-children').click(function() {
  317. $('> ul', this).slideToggle(200);
  318. });
  319. }
  320. });
  321. /*****************************
  322. Custom Accordion
  323. ******************************/
  324. $(function() {
  325. $('.custom_accordion .accordion_wrapper').each(function(index){
  326. $(this).find('.accordion_title').attr("data-id", index);
  327.  
  328. if(index === 0) {
  329. $(this).addClass('active');
  330. }
  331.  
  332. });
  333.  
  334.  
  335. $('.acc_subcontent').each(function(index){
  336. $(this).attr("id", index);
  337. if(index === 0) {
  338. $(this).addClass('active');
  339. }
  340.  
  341. mainAcc = $('.custom_accordion .accordion_wrapper .accordion_title[data-id=' + index + ']').parent().find(".accordion_inner");
  342. $(this).clone().appendTo(mainAcc);
  343.  
  344. });
  345.  
  346.  
  347. $('.custom_accordion .accordion_wrapper .accordion_title').on('click', function () {
  348. if ($(this).parent().hasClass('active')) {
  349. $(this).parent().removeClass('active');
  350. } else {
  351. $('.custom_accordion .accordion_wrapper .accordion_inner').hide();
  352. $('.custom_accordion .accordion_wrapper').removeClass('active');
  353. $(this).parent().addClass('active');
  354. $('.custom_accordion .accordion_wrapper.active .accordion_inner').slideToggle();
  355. }
  356. });
  357.  
  358. $(".accordion_title").click(function() {
  359. if ($(".accordion_wrapper").hasClass("active") == true) {
  360. $('.acc_subcontent:visible').hide();
  361. console.log($(this).data("id"));
  362. $('.acc_subcontent[id=' + $(this).data("id") + ']').delay(300).fadeIn();
  363. } else {
  364. $('.acc_subcontent:visible').hide();
  365. }
  366. });
  367. });
  368.  
  369.  
  370. // Custom Tabs With arrows
  371. // $(function() {
  372. // $('.tab-prev').click(function() {
  373. // if ($('.vc_tta-panels .vc_tta-panel.vc_active').prev().length != 0) {
  374. // $('.vc_tta-panels .vc_tta-panel.vc_active').removeClass('vc_active').prev().addClass('vc_active').click();
  375. // $('.vc_tta-tabs-list .vc_tta-tab.vc_active').removeClass('vc_active').prev().addClass('vc_active').click();
  376. // }
  377. // });
  378.  
  379. // $('.tab-next').click(function() {
  380. // if ($('.vc_tta-panels .vc_tta-panel.vc_active').next().length != 0) {
  381. // $('.vc_tta-panels .vc_tta-panel.vc_active').removeClass('vc_active').next().addClass('vc_active').click();
  382. // $('.vc_tta-tabs-list .vc_tta-tab.vc_active').removeClass('vc_active').next().addClass('vc_active').click();
  383. // }
  384. // });
  385.  
  386. // });
  387.  
  388.  
  389. /*****************************
  390. Modal
  391. ******************************/
  392. $(function() {
  393.  
  394. $('.members_modal').appendTo('footer.footer');
  395. $('.search_modal').appendTo('.search_modal_footer');
  396.  
  397. jQuery("div[id^='modal']").each(function(){
  398.  
  399. var currentModal = jQuery(this);
  400.  
  401. //click next
  402. currentModal.find('.btn-next').click(function(){
  403. currentModal.modal('hide');
  404. currentModal.closest("div[id^='modal']").nextAll("div[id^='modal']").first().modal('show');
  405. });
  406.  
  407. //click prev
  408. currentModal.find('.btn-prev').click(function(){
  409. currentModal.modal('hide');
  410. currentModal.closest("div[id^='modal']").prevAll("div[id^='modal']").first().modal('show');
  411. });
  412.  
  413. });
  414.  
  415. });
  416.  
  417.  
  418. /********************
  419. Team Filter
  420. *********************/
  421. jQuery(function() {
  422.  
  423.  
  424. jQuery('.team_filter .searchandfilter > ul li').each(function(){
  425.  
  426.  
  427. var filterHeading = jQuery(this).find("h4");
  428. var activefilter = jQuery(this).find('li.sf-option-active label').text();
  429. filterHeading.toggleClass("active");
  430. filterHeading.text(activefilter);
  431.  
  432. jQuery(this).find("h4").click(function(e) {
  433. e.preventDefault();
  434. jQuery(this).toggleClass('active');
  435. jQuery(this).siblings('ul').toggleClass("show_filter");
  436. jQuery(this).parent().siblings().find("h4").removeClass("active");
  437.  
  438.  
  439. return true;
  440. });
  441.  
  442. });
  443.  
  444. jQuery(document).mouseup(function(e){
  445. var container = jQuery(".team_filter .searchandfilter");
  446. // If the target of the click isn't the container
  447. if(!container.is(e.target) && container.has(e.target).length === 0){
  448. jQuery(".team_filter .searchandfilter ul li ul.show_filter").toggleClass('show_filter');
  449. }
  450. });
  451.  
  452. });
  453.  
  454. /********************
  455. Resources Filter
  456. *********************/
  457. jQuery(function() {
  458.  
  459.  
  460. jQuery('.resources_filter .searchandfilter > ul > li').each(function(){
  461.  
  462. var resourceFilterHeading = jQuery(this).find("h4");
  463. var resourceActivefilter = jQuery(this).find('li.sf-option-active label').text();
  464. resourceFilterHeading.toggleClass("active");
  465. resourceFilterHeading.text(resourceActivefilter);
  466.  
  467.  
  468. resourceFilterHeading.click(function(e) {
  469. e.preventDefault();
  470. jQuery(this).toggleClass('active');
  471. jQuery(this).siblings('ul').toggleClass("show_filter");
  472. jQuery(this).parent().siblings().find("h4").removeClass("active");
  473. return true;
  474. });
  475.  
  476. });
  477.  
  478. jQuery(document).mouseup(function(e){
  479. var container = jQuery(".resources_filter .searchandfilter");
  480. // If the target of the click isn't the container
  481. if(!container.is(e.target) && container.has(e.target).length === 0){
  482. jQuery(".resources_filter .searchandfilter ul li ul.show_filter").toggleClass('show_filter');
  483. }
  484. });
  485.  
  486.  
  487. });
  488.  
  489.  
  490. /*****************************
  491. Mobile Page Menu
  492. ******************************/
  493. $(function() {
  494. var windowWidth = $(window).width();
  495. if (windowWidth <= 767) {
  496. $('.page_menu .widget_nav_menu').prepend("<a class='open-page-menu'>Open Menu</a>");
  497. var pageMenuActive = $('.page_menu .widget_nav_menu').find('.current_page_item a').text();
  498. $('.open-page-menu').text(pageMenuActive);
  499.  
  500. $('.open-page-menu').click(function(){
  501. $(this).next('div').slideToggle();
  502. });
  503. }
  504.  
  505. });
  506.  
  507.  
  508.  
  509. // $(function() {
  510. // $(document).ready(function() {
  511. // $('.disable_link a.mega-menu-link').click(function(e){
  512. // e.preventDefault();
  513. // });
  514. // });
  515. // });
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523. /********************
  524. Case Study Widget Carousel
  525. *********************/
  526. $(function() {
  527.  
  528. var windowWidth = $(window).width();
  529.  
  530. $('.testimonial_blocks .slide-for').slick({
  531. respondTo: 'slider',
  532. adaptiveHeight: true,
  533. infinite: true,
  534. autoplay: true,
  535. autoplaySpeed: 4000,
  536. slidesToShow: 1,
  537. slidesToScroll: 1,
  538. arrows: false,
  539. dots: false,
  540. fade: true,
  541. asNavFor: '.testimonial_blocks .slide-nav',
  542. swipe: false,
  543. swipeToSlide: false,
  544. draggable: false,
  545. //variableWidth: true
  546. responsive: [
  547. {
  548. breakpoint: 1024,
  549. settings: {
  550. dots: true
  551. }
  552. },
  553. ]
  554. });
  555.  
  556. $('.testimonial_blocks .slide-nav').slick({
  557. respondTo: 'slider',
  558. adaptiveHeight: true,
  559. dots: false,
  560. arrows: false,
  561. infinite: false,
  562. // autoplay: true,
  563. autoplaySpeed: 3000,
  564. slidesToShow: 5,
  565. slidesToScroll: 1,
  566. asNavFor: '.testimonial_blocks .slide-for',
  567. centerMode: false,
  568. centerPadding: '0',
  569. focusOnSelect: true,
  570. //variableWidth: true
  571. responsive: [
  572. {
  573. breakpoint: 1024,
  574. settings: {
  575. slidesToShow:4,
  576. slidesToScroll: 1,
  577. }
  578. },
  579. {
  580. breakpoint: 768,
  581. settings: {
  582. slidesToShow:2,
  583. slidesToScroll: 2,
  584. }
  585. },
  586. {
  587. breakpoint: 767,
  588. settings: {
  589. slidesToShow:1,
  590. slidesToScroll: 1,
  591. }
  592. },
  593. ]
  594. });
  595.  
  596. $page_info = $('.resource_slider__info');
  597. $resource_num = $('.resource_slider__num');
  598. $resource_slider = $('.resource_slider .slide-for');
  599.  
  600. $resource_slider_nav = $('.resource_slider .slide-nav');
  601. $slide_info = $('.resource_slider__meta');
  602.  
  603. $resource_slider.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
  604. var i = (currentSlide ? currentSlide : 0) + 1;
  605. $page_info.text(i + '|' + slick.slideCount);
  606.  
  607. $('.resource_slider .slide-nav.slick-slide').each(function(i,v){
  608. console.log($(i))
  609. });
  610. });
  611.  
  612. $resource_slider_nav.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
  613. $(this).find('.slick-slide').each(function(i,v){
  614. $(v).find('.resource_slider__num').text(i + 1 + '. ')
  615. });
  616. });
  617.  
  618. $('.resource_slider .slide-for').slick({
  619. respondTo: 'slider',
  620. infinite: true,
  621. // autoplay: true,
  622. autoplaySpeed: 5000,
  623. adaptiveHeight: true,
  624. slidesToShow: 1,
  625. slidesToScroll: 1,
  626. arrows: true,
  627. dots: false,
  628. asNavFor: '.resource_slider .slide-nav',
  629. swipe: true,
  630. swipeToSlide: true,
  631. draggable: true,
  632. prevArrow: $('.resource_slider__arrow .prev'),
  633. nextArrow: $('.resource_slider__arrow .next'),
  634. });
  635.  
  636. $('.resource_slider .slide-nav').slick({
  637. dots: false,
  638. arrows: false,
  639. infinite: true,
  640. autoplaySpeed: 5000,
  641. slidesToShow: 3,
  642. slidesToScroll: 1,
  643. centerMode: true,
  644. centerPadding: '0',
  645. focusOnSelect: true,
  646. responsive: [
  647. {
  648. breakpoint: 1024,
  649. settings: {
  650. slidesToShow:2,
  651. slidesToScroll: 1,
  652. }
  653. },
  654. {
  655. breakpoint: 767,
  656. settings: {
  657. slidesToShow:1,
  658. slidesToScroll: 1,
  659. }
  660. },
  661. ]
  662. });
  663. });
  664.  
  665.  
  666.  
  667.  
  668.  
  669. /********************
  670. Locations Carousel
  671. *********************/
  672. $(function() {
  673.  
  674. var windowWidth = $(window).width();
  675.  
  676. $('.locations_carousel .slide-for').slick({
  677. respondTo: 'slider',
  678. adaptiveHeight: true,
  679. infinite: true,
  680. autoplay: false,
  681. speed: 500,
  682. slidesToShow: 1,
  683. slidesToScroll: 1,
  684. arrows: false,
  685. dots: false,
  686. fade: true,
  687. asNavFor: '.locations_carousel .slide-nav',
  688. swipe: false,
  689. swipeToSlide: false,
  690. draggable: false,
  691. //variableWidth: true
  692. });
  693.  
  694.  
  695.  
  696. $('.locations_carousel .slide-nav').slick({
  697. respondTo: 'slider',
  698. adaptiveHeight: true,
  699. dots: false,
  700. arrows: false,
  701. infinite: false,
  702. autoplay: false,
  703. speed: 500,
  704. slidesToShow: 3,
  705. slidesToScroll: 1,
  706. asNavFor: '.locations_carousel .slide-for',
  707. centerMode: false,
  708. centerPadding: '0',
  709. focusOnSelect: true,
  710. //variableWidth: true
  711. responsive: [
  712. {
  713. breakpoint: 1024,
  714. settings: {
  715. slidesToShow:3,
  716. slidesToScroll: 1,
  717. }
  718. },
  719. {
  720. breakpoint: 768,
  721. settings: {
  722. slidesToShow:2,
  723. slidesToScroll: 2,
  724. }
  725. },
  726. {
  727. breakpoint: 767,
  728. settings: {
  729. slidesToShow:1,
  730. slidesToScroll: 1,
  731. }
  732. },
  733. ]
  734. });
  735.  
  736.  
  737. });
  738.  
  739.  
  740. /********************
  741. Boxes Carousel
  742. *********************/
  743. $(function() {
  744.  
  745. $(".boxes_carousel").not('.slick-initialized').slick({
  746. dots:true,
  747. appendDots: $('.boxes_dots'),
  748. respondTo: 'slider',
  749. adaptiveHeight: true,
  750. infinite: false,
  751. autoplay: false,
  752. speed: 500,
  753. slidesToShow: 2,
  754. slidesToScroll: 1,
  755. arrows: true,
  756. prevArrow: $('.boxes_arrows .boxes-prev'),
  757. nextArrow: $('.boxes_arrows .boxes-next'),
  758. responsive: [
  759. {
  760. breakpoint: 767,
  761. settings: {
  762. slidesToShow:1,
  763. slidesToScroll: 1,
  764. }
  765. },
  766. ]
  767. });
  768.  
  769. });
  770.  
  771. /********************
  772. Teams Carousel
  773. *********************/
  774. $(function() {
  775.  
  776. $(".teams_carousel").not('.slick-initialized').slick({
  777. dots:true,
  778. appendDots: $('.teams_dots'),
  779. respondTo: 'slider',
  780. adaptiveHeight: true,
  781. infinite: false,
  782. autoplay: false,
  783. speed: 500,
  784. slidesToShow: 1,
  785. slidesToScroll: 1,
  786. arrows: true,
  787. prevArrow: $('.teams_arrows .teams-prev'),
  788. nextArrow: $('.teams_arrows .teams-next'),
  789. });
  790.  
  791. });
  792.  
  793.  
  794.  
  795.  
  796.  
  797. $(function() {
  798.  
  799. $('.gallery-slider').not('.slick-initialized').slick({
  800. infinite: true,
  801. slidesToShow: 2,
  802. slidesToScroll: 1,
  803. autoplay: true,
  804. autoplaySpeed: 0,
  805. speed: 6000,
  806. cssEase: "linear",
  807. pauseOnHover: false,
  808. arrows: false,
  809. dots:false,
  810. responsive: [
  811. {
  812. breakpoint: 992,
  813. settings: {
  814. slidesToShow:2,
  815. slidesToScroll: 1,
  816. autoplay: true,
  817. autoplaySpeed: 0,
  818. pauseOnHover: true,
  819. }
  820. },
  821. {
  822. breakpoint: 767,
  823. settings: {
  824. slidesToShow: 1,
  825. slidesToScroll: 1,
  826. autoplay: true,
  827. autoplaySpeed: 0,
  828. pauseOnHover: true,
  829. }
  830. }]
  831. });
  832.  
  833. });
  834.  
  835.  
  836. // Awards Logo
  837. $(function() {
  838.  
  839. $('.awards_grid').not('.slick-initialized').slick({
  840. slidesToShow: 5,
  841. slidesToScroll: 5,
  842. arrows: false,
  843. dots: false,
  844. responsive: [
  845.  
  846. {
  847. breakpoint: 767,
  848. settings: {
  849. slidesToShow: 2,
  850. slidesToScroll: 1,
  851. }
  852. }]
  853. });
  854.  
  855. });
  856.  
  857.  
  858. // Partners Logo
  859. $(function() {
  860.  
  861. $('.partners_grid').not('.slick-initialized').slick({
  862. slidesToShow: 6,
  863. slidesToScroll: 6,
  864. arrows: false,
  865. dots: false,
  866. responsive: [
  867.  
  868. {
  869. breakpoint: 767,
  870. settings: {
  871. slidesToShow: 2,
  872. slidesToScroll: 1,
  873. }
  874. }]
  875. });
  876.  
  877. });
  878.  
  879. // $(function() {
  880. // $('.project_gallery ul').not('.slick-initialized').slick({
  881. // slidesToShow: 1,
  882. // slidesToScroll: 1,
  883. // arrows: false,
  884. // dots: false,
  885. // fade: false,
  886. // });
  887. // });
  888.  
  889.  
  890. $(function() {
  891. var windowWidth = $(window).width();
  892. // Tablet
  893. if(windowWidth <= 1024) {
  894. $('.hero_images__overlay .wpb_wrapper').not('.slick-initialized').slick({
  895. slidesToShow: 1,
  896. slidesToScroll: 1,
  897. arrows: false,
  898. dots: false
  899. });
  900. }
  901.  
  902. // Mobile
  903. if (windowWidth <= 767) {
  904.  
  905. // var divs = $(".post_list > .post_item");
  906. // for(var i = 0; i < divs.length; i+=3) {
  907. // divs.slice(i, i+3).wrapAll("<div class='posts_carousel'></div>");
  908. // }
  909.  
  910. // $('.post_list .posts_carousel').not('.slick-initialized').slick({
  911. // slidesToShow: 1,
  912. // slidesToScroll: 1,
  913. // arrows: false,
  914. // dots: true,
  915. // fade: false,
  916. // adaptiveHeight: true
  917. // });
  918.  
  919. $('.custom_accordion .vc_tta-panels, .mobile_slider').not('.slick-initialized').slick({
  920. slidesToShow: 1,
  921. slidesToScroll: 1,
  922. autoplay: true,
  923. autoplaySpeed: 4000,
  924. arrows: false,
  925. dots: true
  926. });
  927. }
  928. });
  929.  
  930.  
  931. /*****************************
  932. Mobile Tabs
  933. ******************************/
  934. // $(function() {
  935.  
  936. // var windowWidth = $(window).width();
  937. // if (windowWidth <= 767) {
  938. // $('.tabs_section .vc_tta-tabs-container').prepend("<a class='open-tab'>Open Tab</a>");
  939. // var tabActive = $('.tabs_section .vc_tta-tabs-container').find('.vc_active').text();
  940. // $('.open-tab').text(tabActive);
  941.  
  942. // $('.open-tab').click(function(){
  943. // $(this).next('ul').slideToggle();
  944. // });
  945.  
  946. // $('.tabs_section .vc_tta-tabs-container li').click(function(){
  947. // $(this).parent().slideToggle();
  948. // var currentTab = $(this).find('span').text();
  949. // $('.open-tab').text(currentTab);
  950. // });
  951. // }
  952.  
  953. // });
  954. /*****************************
  955. Graphs / Charts / Odometer
  956. ******************************/
  957. $(function() {
  958. $('.counter').countUp({
  959. 'time': 2000,
  960. 'delay': 30
  961. });
  962.  
  963. });
  964.  
  965. $(function() {
  966. var waypoints = $('.vc_section.terms').waypoint({
  967. handler: function(direction) {
  968. $(this).toggleClass('active_view')
  969. },
  970. offset: '50%'
  971. });
  972. });
  973.  
  974.  
  975.  
  976. /********************
  977. Mobile tabs
  978. *********************/
  979. $(function() {
  980. var windowWidth = $(window).width();
  981. if (windowWidth <= 767) {
  982.  
  983.  
  984. $(window).load(function(){
  985. var activeloadedText= $('.vc_tta-tab.vc_active > a .vc_tta-title-text').text();
  986. $('.mobile_tab_menu').text(activeloadedText);
  987. });
  988.  
  989. $(".vertical_tabs").each(function(){
  990.  
  991. var mobileMenu = $(this).find('.mobile_tab_menu');
  992. var tabItem = $(this).find('.vc_tta-tab > a');
  993.  
  994.  
  995. var activeText = $(this).find(".vc_tta-tab.vc_active .vc_tta-title-text").text();
  996. mobileMenu.text(activeText);
  997.  
  998. mobileMenu.click(function(e){
  999. e.preventDefault();
  1000. $(this).toggleClass("active");
  1001. $(this).parent().find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').toggleClass("show");
  1002.  
  1003. });
  1004.  
  1005.  
  1006.  
  1007. $('.footer-col a').click(function(e){
  1008. var activeClickedtextonPage = $(this).text();
  1009. mobileMenu.text(activeClickedtextonPage);
  1010.  
  1011. $('body').find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').removeClass("show");
  1012. mobileMenu.removeClass("active");
  1013. });
  1014.  
  1015.  
  1016. tabItem.click(function(e){
  1017. var activeClickedtext = $(this).find('.vc_tta-title-text').text();
  1018. mobileMenu.text(activeClickedtext);
  1019.  
  1020. e.preventDefault();
  1021. $(this).parents().find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').removeClass("show");
  1022. mobileMenu.removeClass("active");
  1023. });
  1024.  
  1025.  
  1026. });
  1027. }
  1028.  
  1029. });
  1030.  
  1031.  
  1032.  
  1033. /********************
  1034. Mobile VC ROW Swap
  1035. *********************/
  1036. $(function() {
  1037. var windowWidth = $(window).width();
  1038. if (windowWidth <= 767) {
  1039. $('.vc_row.mobile_swap').wrapAll('<div class="mobile_swap_wrapper" />');
  1040. }
  1041. });
  1042.  
  1043.  
  1044. $(document).ready(function() {
  1045. var bodyToggle = $('body');
  1046.  
  1047. $('.mobile-toggle-wrap').click(function() {
  1048. bodyToggle.toggleClass('collapse_menu');
  1049. });
  1050.  
  1051. function mobile_navigation() {
  1052. var windowWidth_1024px = $(window).width();
  1053. if (windowWidth_1024px <= 1279) {
  1054.  
  1055. // Second Level
  1056. $('#mobile-menu li.menu-item-has-children').each(function(el) {
  1057. $(this).prepend("<a class='open-menu'></a>");
  1058. });
  1059.  
  1060. $('#mobile-menu li.menu-item-has-children:has(ul)').addClass("inactive");
  1061. $('#mobile-menu li.menu-item-has-children:has(ul) ul').css('display', 'none');
  1062.  
  1063. $('.open-menu').click(function() {
  1064.  
  1065. if ($(this).closest('li.menu-item-has-children').hasClass('active')){
  1066. $(this + 'a').attr('aria-expanded','false');
  1067. }
  1068. if ($(this).closest('li.menu-item-has-children').hasClass('inactive')){
  1069. $(this + 'a').attr('aria-expanded','true');
  1070. }
  1071.  
  1072. var checkElement = $(this).next().next();
  1073. $(this).parent('li.menu-item-has-children ').removeClass('active');
  1074. $(this).parent('li.menu-item-has-children').addClass('active').removeClass("inactive");
  1075.  
  1076. if ((checkElement.is('ul')) && (checkElement.is(':visible'))) {
  1077.  
  1078. console.log
  1079. $(this).parent().siblings('li.menu-item-has-children').removeClass('active').addClass('inactive');
  1080. checkElement.slideUp('normal');
  1081. }
  1082.  
  1083. if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
  1084. $('ul ul:visible').not($(this).closest('ul')).slideUp('normal');
  1085. checkElement.slideDown('normal');
  1086. }
  1087.  
  1088. if (checkElement.is('ul')) {
  1089. return false;
  1090. } else {
  1091. return true;
  1092. }
  1093. });
  1094. // END Third Level Dropdown
  1095.  
  1096. }
  1097. }
  1098.  
  1099. mobile_navigation();
  1100.  
  1101. });
  1102.  
  1103.  
  1104. $('a[href^="#"].scrollTo, .scrollTo a[href^="#"], .scrollTo a').click(function()
  1105. {
  1106. if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
  1107. || location.hostname == this.hostname)
  1108. {
  1109.  
  1110. var target = $(this.hash),
  1111. headerHeight = $('.header_wrapper').outerHeight(),
  1112. stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
  1113. target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  1114.  
  1115. headerOffset = headerHeight + stickyNav;
  1116. headerOffset = headerOffset + 60;
  1117.  
  1118. if (target.length)
  1119. {
  1120. $('html,body').animate({
  1121. scrollTop: target.offset().top - headerOffset
  1122. }, 500);
  1123. return false;
  1124. }
  1125. }
  1126. });
  1127.  
  1128. // Site Navigator
  1129. $('#navigation a[href^="#"].scrollNav, #navigation .scrollNav a[href^="#"], #navigation .scrollNav a').click(function()
  1130. {
  1131. var bodyToggle = $('body');
  1132. bodyToggle.toggleClass('collapse_menu');
  1133.  
  1134. if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
  1135. || location.hostname == this.hostname)
  1136. {
  1137.  
  1138. var target = $(this.hash),
  1139. headerHeight = $('.header_wrapper').outerHeight(),
  1140. stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
  1141. target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  1142.  
  1143. headerOffset = headerHeight + stickyNav;
  1144. headerOffset = headerOffset + 60;
  1145.  
  1146. if (target.length)
  1147. {
  1148. $('html,body').animate({
  1149. scrollTop: target.offset().top - headerOffset
  1150. }, 1000, 'swing');
  1151. return false;
  1152. }
  1153. }
  1154. });
  1155.  
  1156. // to top right away
  1157. if ( window.location.hash ) scroll(0,0);
  1158.  
  1159. // void some browsers issue
  1160. setTimeout( function() { scroll(0,0); }, 1);
  1161. $(function() {
  1162. headerHeight = $('.header_wrapper').outerHeight(),
  1163. stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
  1164. headerOffset = headerHeight + stickyNav;
  1165. scrollPadding = $('.vc_tta-tabs').length ? 120 : 0
  1166.  
  1167. setTimeout(function() {
  1168. // *only* if we have anchor on the url
  1169. if(window.location.hash) {
  1170. // smooth scroll to the anchor id
  1171. $('html, body').animate({
  1172. scrollTop: $(window.location.hash).offset().top - headerOffset - scrollPadding
  1173. }, 1000, 'swing');
  1174. }
  1175. }, 1000);
  1176. });
  1177.  
  1178. function removeBR() {
  1179. if ($(window).width() <= 1080) {
  1180. $('.banner h4 br').remove();
  1181. $('.vc_custom_heading br').remove();
  1182. $('.hero_section p br').remove();
  1183. $('.wpb_text_column:not(.contact_details) p br').remove();
  1184. $('.sub_content br').remove();
  1185. $('.scrollToNav h6 br').remove();
  1186. }
  1187. $('.details_content p:empty').remove();
  1188. }
  1189. $(window).resize(removeBR);
  1190. $(window).load(removeBR);
  1191. $(document).ready(removeBR);
  1192.  
  1193. $(function() {
  1194. let accordionTarget = document.querySelectorAll('.custom_accordion__target > div')
  1195. let accordionToggle = document.querySelectorAll('.vc_tta-panels .vc_tta-panel')
  1196. let accordionRowTarget = document.querySelectorAll('.custom_accordion__row .vc_row')
  1197. let accordionRowToggle = document.querySelectorAll('.custom_boxes .box_wrap')
  1198.  
  1199. function initAccordionTarget(target, trigger) {
  1200. if(target.length > 1) {
  1201. target[0].classList.add('active')
  1202.  
  1203. trigger.forEach(function(e, i) {
  1204. e.addEventListener('click', function() {
  1205. triggerTarget(target, i)
  1206. })
  1207. })
  1208. }
  1209.  
  1210. }
  1211.  
  1212. function triggerTarget(elem, i) {
  1213. elem.forEach(function(j) {
  1214. if(j.classList.contains('active')) {
  1215. j.classList.remove('active')
  1216. }
  1217. })
  1218. elem[i].classList.add('active')
  1219. }
  1220.  
  1221. initAccordionTarget(accordionTarget, accordionToggle)
  1222. initAccordionTarget(accordionRowTarget, accordionRowToggle)
  1223.  
  1224. $('.custom_accordion .vc_tta-panels').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  1225. if(accordionTarget.length > 0)
  1226. triggerTarget(accordionTarget, nextSlide)
  1227. });
  1228.  
  1229. $('.custom_boxes').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  1230. if(accordionRowTarget.length > 0) {
  1231. triggerTarget(accordionRowTarget, currentSlide)
  1232. }
  1233.  
  1234. });
  1235. })
  1236.  
  1237. })($);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement