(function( $ ) { 'use strict'; jQuery(document).ready(function () { var $ = jQuery; // DESKTOP MENU $("#main-nav li").on({ mouseenter: function () { var $submenu = $(this).children("ul"); var $menulink = $(this).children("a"); if ($menulink.attr("aria-expanded") != "true") { $submenu.attr("aria-hidden", "false"); $menulink.attr("aria-expanded", "true"); } }, mouseleave: function () { var $submenu = $(this).children("ul"); var $menulink = $(this).children("a"); if ($menulink.attr("aria-expanded") != "false") { $menulink.attr("aria-expanded", "false"); $submenu.attr("aria-hidden", "true"); } } }); // MOBILE MENU $("#show-nav-menu").on({ click: function (e) { if ($("#mobile-menu-wrap").attr("aria-expanded") == "true") { $("#mobile-menu-wrap").attr("aria-expanded", "false"); } else { $("#mobile-menu-wrap").attr("aria-expanded", "true"); } // Stop the normal click from occurring e.preventDefault(); e.stopPropagation(); } }); $("#bm-wrap").on("click", function (e) { if ($("#mobile-menu-wrap").attr("aria-expanded") == "true") { $("#mobile-menu-wrap").attr("aria-expanded", "false"); // Stop the normal click from occurring e.preventDefault(); e.stopPropagation(); } }); $("#mobile-menu-wrap #menu-main-menu li.menu-item-has-children > a").on("click", function (e) { if ($(this).attr("aria-expanded") == "true") { $(this).attr("aria-expanded", "false"); } else { $(this).attr("aria-expanded", "true"); } // Stop the normal click from occurring e.preventDefault(); e.stopPropagation(); }); }); function hr_circle_progress() { var $ = jQuery; $('.easyPieChart:in-viewport').easyPieChart({ size: 220, scaleColor: false, lineWidth: 2 }); } function hr_progress_bar() { var $ = jQuery; $(".bm-progress-bar .progress-outer:in-viewport").each(function () { if (!$(this).hasClass('activated')) { $(this).addClass('activated'); var $that = $(this); $that.animate({ width: $(this).attr("data-width") + '%' }, 1400); } }); } function hr_counter() { var $j = jQuery; /* Counters */ $j('.bm-counter:in-viewport').each(function () { if (!$j(this).hasClass('activated')){ var countAsset = $j(this), countNumber = countAsset.find('.count-number'), countDivider = countAsset.find('.count-separator').find('span'), countSubject = countAsset.find('.count-subject'), countTo = countAsset.find('.count-number').attr('data-to'), countFrom = countAsset.find('.count-number').attr('data-from'), countSpeed = parseInt(countAsset.find('.count-number').attr('data-speed')); countAsset.addClass('activated'); $j({countNum: countFrom}).animate({countNum: countTo}, { duration: countSpeed, easing:'linear', step: function() { countAsset.find('.count-number').text(Math.floor(this.countNum).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }, complete: function() { countAsset.find('.count-number').text(this.countNum.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")); countDivider.animate({'width': 50}, 650); countSubject.delay(100).animate({'opacity': 1,'bottom': '0px'}, 650); } }); } }); } jQuery(document).on('ready scroll', function () { var $ = jQuery; hr_circle_progress(); hr_progress_bar(); hr_counter(); }.bind(this)); jQuery(document).on('ready', function() { jQuery('.nav-tabs > li:first-child').addClass("current-tab"); }) jQuery('.nav-tabs > li').on('click', function() { var $ = jQuery; var index = $(this).index() + 1; var $elRoot = $(this).parents('.wpb_tour_tabs_wrapper'); $(".tab-content:nth-of-type(" + index + ")", $elRoot).show(); $(".tab-content:not(:nth-of-type(" + index + "))", $elRoot).hide(); $(this).addClass("current-tab"); $(this).siblings().removeClass("current-tab"); }); jQuery(".bm-accordion-tab").on("click", function() { var $ = jQuery; var pane = $(this).siblings(".bm-accordion-pane"); pane.slideToggle(300); }); jQuery(document).on("ready", function() { var $ = jQuery; $(".social-icons > li > a").mouseenter(function() { var color = $(this).attr('data-hover-color'); $(this).css("background", color); }).mouseleave(function() { //$(this).css("background", "transparent"); $(this).attr("style", ""); }); }); jQuery(document).on("ready", function() { jQuery(".video-wrapper.shortcode-container").fitVids(); }); // Scroll to top button jQuery(window).scroll(function (e) { var scroll = jQuery(window).scrollTop(); if (scroll > 800) { jQuery(".scroll-to-top").addClass("show-button"); jQuery(".scroll-to-top").removeClass("hide-button"); } else { jQuery(".scroll-to-top").addClass("hide-button"); jQuery(".scroll-to-top").removeClass("show-button"); } }); // Sticky header jQuery(document).on("ready", function(e) { jQuery("#header-inner").sticky({topSpacing:0}); }); jQuery(window).on("scroll", function(e) { jQuery("[data-animate]:in-viewport").each(function() { jQuery(this).addClass(jQuery(this).attr("data-animate")) .addClass(jQuery(this).attr("data-animate-delay")) .addClass("animated"); }) }); jQuery(window).trigger("scroll"); })();