/* ================================================== Custom jQuery functions. ================================================== */ (function(){ //var _page_loader = false; // USE STRICT "use strict"; var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; ///////////////////////////////////////////// // HEADER FUNCTIONS ///////////////////////////////////////////// var header = { init: function() { }, StickyHeader:function () { // sticky header if(jQuery('.sticky-header').length >= 1) { var sticky_top = jQuery('.sticky-header').css('top'); var sticky_start = sticky_top.replace('px','') - 105; jQuery('.sticky-header').css('opacity',1); jQuery('.sticky-header').css('top', sticky_start+'px'); jQuery('.init-sticky-header').waypoint(function(direction) { if(direction === "down") { if(jQuery('#wpadminbar').length >= 1) { sticky_top = jQuery('#wpadminbar').outerHeight()+"px"; } jQuery('.sticky-header').show(); jQuery('.sticky-header').animate({ height: "105px", top: sticky_top, }, 500 ); } else if(direction === "up") { jQuery('.sticky-header').animate({ height: "0", top: -105, }, 300 ); jQuery('.sticky-header').hide(); } }); } }, MegaMenuPosition:function() { var menu_items = jQuery(".drop_down > ul > li.standard-menu"); menu_items.each( function(i) { var browser_width = jQuery(window).width()-16; var menu_item_position = jQuery(menu_items[i]).offset().left; var sub_menu_width = jQuery(menu_items[i]).find('.sub-menu .inner ul').width(); var menu_item_from_left = browser_width - menu_item_position + 25; var sub_menu_from_left; if(jQuery(menu_items[i]).find('li.sub').length > 0){ sub_menu_from_left = browser_width - menu_item_position - sub_menu_width + 20; } if(menu_item_from_left < sub_menu_width || sub_menu_from_left < sub_menu_width){ jQuery(menu_items[i]).find('.sub-menu').addClass('right'); jQuery(menu_items[i]).find('.sub-menu .inner ul').addClass('right'); } }); }, MegaMenu:function() { var menu_dropdown_height_set = false; var menu_items = jQuery('.drop_down > ul > li'); menu_items.each( function(i) { if (jQuery(menu_items[i]).find('.sub-menu').length > 0) { if(jQuery(menu_items[i]).hasClass('wide-menu')) { var dropdown = jQuery(this).find('.inner > ul'); var dropdownPadding = parseInt(dropdown.css('padding-left').slice(0, -2)) + parseInt(dropdown.css('padding-right').slice(0, -2)); jQuery(this).find('.sub-menu').css('left',0); var tallest = 0; jQuery(this).find('.sub-menu > .inner > ul > li').each(function() { var thisHeight = jQuery(this).height(); if(thisHeight > tallest) { tallest = thisHeight; } }); jQuery(this).find('.sub-menu > .inner > ul > li').height(tallest); var row_number; if(jQuery(this).find('.sub-menu > .inner > ul > li').length > 5){ row_number = 5; }else{ row_number = jQuery(this).find('.sub-menu > .inner > ul > li').length; } var width = row_number*(jQuery(this).find('.sub-menu > .inner > ul > li').outerWidth()); jQuery(this).find('.sub-menu > .inner > ul').width(width).addClass('menu-'+row_number+'cols'); var left_position = (jQuery(window).width() - 2 * (jQuery(window).width()-jQuery(this).find('.sub-menu').offset().left))/2 + (width+dropdownPadding)/2; jQuery(this).find('.sub-menu').css('left',-left_position); } if(!menu_dropdown_height_set){ jQuery(menu_items[i]).data('original_height', jQuery(menu_items[i]).find('.sub-menu').height() + 'px'); jQuery(menu_items[i]).find('.sub-menu').height(0); } if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { jQuery(menu_items[i]).on("touchstart mouseenter",function(){ jQuery(menu_items[i]).find('.sub-menu').css({'height': jQuery(menu_items[i]).data('original_height'), 'overflow': 'visible', 'visibility': 'visible', 'opacity': '1'}); }).on("mouseleave", function(){ jQuery(menu_items[i]).find('.sub-menu').css({'height': '0px','overflow': 'hidden', 'visivility': 'hidden', 'opacity': '0'}); }); }else{ var config = { interval: 50, over: function(){ jQuery(menu_items[i]).find('.sub-menu').addClass('show_sub'); jQuery(menu_items[i]).find('.sub-menu').stop().css({'height': jQuery(menu_items[i]).data('original_height')}); }, timeout: 100, out: function(){ jQuery(menu_items[i]).find('.sub-menu').stop().css({'height': '0px'}); jQuery(menu_items[i]).find('.sub-menu').removeClass('show_sub'); } }; jQuery(menu_items[i]).hoverIntent(config); } } }); jQuery('.drop_down ul li.wide-menu ul li a').on('click',function(){ var $this = jQuery(this); setTimeout(function() { $this.mouseleave(); }, 500); }); menu_dropdown_height_set = true; }, MobileMenu:function() { jQuery('nav#mobile-menu').css('opacity',1); jQuery('nav#mobile-menu').mmenu({ }); }, MenuToggle:function(){ var menu_items = jQuery('.vertical-menu-toggle > ul > li'); var menu_items_2 = jQuery('.vertical-menu-toggle ul li ul li'); menu_items.each( function(i) { if(jQuery(menu_items[i]).hasClass('sub-menu')){ var subitems_number = jQuery(menu_items[i]).find('.inner > ul > li').length; jQuery(menu_items[i]).hoverIntent({ over: function() { jQuery(menu_items[i]).addClass('open'); jQuery(menu_items[i]).find('.second').slideDown(subitems_number*40, 'easeInOutSine'); }, out: function() { //if(!jQuery(menu_items[i]).hasClass('active')){ jQuery(menu_items[i]).removeClass('open'); jQuery(menu_items[i]).find('.second').slideUp(subitems_number*40, 'easeInOutSine'); //} }, timeout: 1000 }); } }); menu_items_2.each( function(i) { if(jQuery(menu_items_2[i]).hasClass('menu-item-has-children')){ var subitems_number = jQuery(menu_items_2[i]).find('ul > li').length; jQuery(menu_items_2[i]).hoverIntent({ over: function() { jQuery(menu_items_2[i]).addClass('open'); jQuery(menu_items_2[i]).find('ul').slideDown(subitems_number*40, 'easeInOutSine'); }, out: function() { jQuery(menu_items_2[i]).removeClass('open'); jQuery(menu_items_2[i]).find('ul').slideUp(subitems_number*40, 'easeInOutSine'); }, timeout: 1000 }); } }); } }; ///////////////////////////////////////////// // WOOCOMMERCE FUNCTIONS ///////////////////////////////////////////// var woocommerce = { init: function() { jQuery('figcaption .add_to_cart_button').on('click', function() { var button = jQuery(this); var added_text = button.attr("data-added_text"); button.addClass("product-added"); button.text(added_text); }); jQuery('.show-products-link').on('click', function(e) { e.preventDefault(); var linkHref = jQuery(this).attr('href').replace('?', ''); var currentQuery = document.location.search; if (currentQuery.indexOf('?') >= 0) { window.location = currentQuery + '&' + linkHref; } else { window.location = document.location + '?' + linkHref; } }); jQuery('ul.products li').hover(function() { var imageOverlay = jQuery(this).find('.image-overlay'); imageOverlay.animate({ top: jQuery(this).height()*-1 }, 400); }, function() { var imageOverlay = jQuery(this).find('.image-overlay'); imageOverlay.animate({ top: 0 }, 400); }); if (jQuery.fn.imagesLoaded) { woocommerce.productResize(); jQuery(window).on('resize', function(){ woocommerce.productResize(); }); } }, productResize: function() { jQuery('ul.products').imagesLoaded(function() { jQuery('ul.products li').each(function() { var productImageHeight = jQuery(this).find('.product-image > img').height(); jQuery(this).find('figure').css('padding-bottom', productImageHeight + 'px'); }); }); } }; ///////////////////////////////////////////// // PORTFOLIO FUNCTIONS ///////////////////////////////////////////// var portfolio = { amazingfilter: function() { var $container = jQuery('#portfolio'); $container.imagesLoaded(function () { $container.isotope({ layoutMode : 'masonry', filter: '*', animationOptions: { duration: 750, easing: 'linear', queue: false, } }); }); // update columnWidth on window resize jQuery(window).on('resize', function(){ $container.isotope('reLayout') }); jQuery('.portfolio-filter ul a').click(function(){ var selector = jQuery(this).attr('data-filter'); $container.isotope({ filter: selector, animationOptions: { duration: 750, easing: 'linear', queue: false, } }); return false; }); var $optionSets = jQuery('.portfolio-filter ul'), $optionLinks = $optionSets.find('a'); $optionLinks.click(function(){ var $this = jQuery(this); if ( $this.hasClass('selected') ) { return false; } var $optionSet = $this.parents('.portfolio-filter ul'); $optionSet.find('.selected').removeClass('selected'); $this.addClass('selected'); }); } }; ///////////////////////////////////////////// // SHORTCODE FUNCTIONS ///////////////////////////////////////////// var shortcode = { init: function() { shortcode.CountAssets(); shortcode.PopupVideo(); shortcode.OurTeam(); }, Accordion: function() { jQuery('.accordion').each(function(){ var acc = jQuery(this).attr("rel") * 2; jQuery(this).find('.accordion-inner:nth-child(' + acc + ')').show(); jQuery(this).find('.accordion-inner:nth-child(' + acc + ')').prev().addClass("active"); }); jQuery('.accordion .accordion-title').click(function() { if(jQuery(this).next().is(':hidden')) { jQuery(this).parent().find('.accordion-title').removeClass('active').next().slideUp(200); jQuery(this).toggleClass('active').next().slideDown(200); } else { jQuery(this).parent().find('.accordion-title').removeClass('active').next().slideUp(200); } return false; }); }, Tab: function() { jQuery('.shortcode_tabgroup').find("div.panel").hide(); jQuery('.shortcode_tabgroup').find("div.panel:first").show(); jQuery('.shortcode_tabgroup').find("ul li:first").addClass('active'); jQuery('.shortcode_tabgroup ul li a').click(function(){ jQuery(this).parent().parent().parent().find('ul li').removeClass('active'); jQuery(this).parent().addClass('active'); var currentTab = jQuery(this).attr('href'); jQuery(this).parent().parent().parent().find('div.panel').hide(); jQuery('.shortcode_tabgroup .panel').removeClass('active'); jQuery(currentTab).fadeIn(300).addClass('active'); jQuery(window).resize(); return false; }); }, CountAssets: function() { jQuery('.nova-count-asset').each(function() { var countAsset = jQuery(this), countNumber = countAsset.find('.count-number .count-span'), countSubject = countAsset.find('.count-subject'); countAsset.appear(function() { countNumber.countTo({ onComplete: function () { countSubject.animate({ 'opacity' : 1, 'bottom' : '0px' }, 600, 'easeOutCubic'); } }); }, {accX: 0, accY: -150}, 'easeInCubic'); }); }, OurTeam : function(){ /* jQuery('ul.team_list_style_1 ').find("li:first .nova-team-items").addClass('active'); jQuery(function(){ jQuery('ul.team_list_style_1 li .nova-team-items').click(function(){ jQuery('ul.team_list_style_1 li .nova-team-items').removeClass('active'); jQuery(this).addClass('active'); }); }); */ }, ButtonHover: function() { if(jQuery('.nova-button').length) { jQuery('.nova-button').each(function() { //hover background color if(typeof jQuery(this).data('hover-background-color') !== 'undefined' && jQuery(this).data('hover-background-color') !== false) { var hover_background_color = jQuery(this).data('hover-background-color'); var initial_background_color = jQuery(this).css('background-color'); jQuery(this).hover( function() { jQuery(this).css('background-color', hover_background_color); }, function() { jQuery(this).css('background-color', initial_background_color); }); } //hover border color if(typeof jQuery(this).data('hover-border-color') !== 'undefined' && jQuery(this).data('hover-border-color') !== false) { var hover_border_color = jQuery(this).data('hover-border-color'); var initial_border_color = jQuery(this).css('border-top-color'); jQuery(this).hover( function() { jQuery(this).css('border-color', hover_border_color); }, function() { jQuery(this).css('border-color', initial_border_color); }); } //hover color if(typeof jQuery(this).data('hover-color') !== 'undefined' && jQuery(this).data('hover-color') !== false) { var hover_color =jQuery(this).data('hover-color'); var initial_color = jQuery(this).css('color'); jQuery(this).hover( function() { jQuery(this).css('color', hover_color); }, function() { jQuery(this).css('color', initial_color); }); } }); } }, IconHover: function() { if(jQuery('.nova-icon-boxed').length) { jQuery('.nova-icon-boxed').each(function() { //hover background color if(typeof jQuery(this).data('background-hover') !== 'undefined' && jQuery(this).data('background-hover') !== false) { var hover_background_color = jQuery(this).data('background-hover'); var initial_background_color = jQuery(this).css('background-color'); var initial_border_color = jQuery(this).css('border-color'); jQuery(this).hover( function() { jQuery(this).css('background-color', hover_background_color); jQuery(this).css('border-color', hover_background_color); }, function() { jQuery(this).css('background-color', initial_background_color); jQuery(this).css('border-color', initial_border_color); }); } //hover color if(typeof jQuery(this).find('.nova-icon').data('hover-color') !== 'undefined' && jQuery(this).find('.nova-icon').data('hover-color') !== false) { var hover_color =jQuery(this).find('.nova-icon').data('hover-color'); var initial_color = jQuery(this).find('.nova-icon').css('color'); jQuery(this).hover( function() { jQuery(this).find('.nova-icon').css('color', hover_color); }, function() { jQuery(this).find('.nova-icon').css('color', initial_color); }); } }); } }, PopupVideo: function() { jQuery('.nova-video-link').unbind().on({ 'click':function(){ if (jQuery(this).data('video-url') !== "") { shortcode.OpenPopupVideo(jQuery(this)); } return false; } }); jQuery('.nova-video-close').unbind().on({ 'click':function(){ shortcode.ClosePopupVideo(); } }); }, OpenPopupVideo: function(element) { jQuery('.nova-video-close').addClass('opened'); jQuery('.nova-video-inner').animate({ top: 0, height: '100%' }, 700, 'swing', function() { jQuery('.nova-video-inner').append(''); }); }, ClosePopupVideo: function() { jQuery('.nova-video-close').removeClass('opened'); jQuery('.nova-video-inner').animate({ top:'-100%' }, 700, 'swing', function(){ jQuery('.nova-video-inner .nova-video').remove(); }); jQuery('.nova-video-inner video').each(function(){ this.pause(); }); setTimeout(function() { jQuery('.nova-video-inner').find('iframe').remove(); }, 1500); return false; } } ///////////////////////////////////////////// // GENERAL FUNCTIONS ///////////////////////////////////////////// var general = { init: function() { if(isMobile.any()) { jQuery('body').addClass("mobile-browser"); } if( !isMobile.any() ){ general.NovaAnimations(); } jQuery(".nova-our-team-detail .team-member-social-icon a").tooltip({ placement : 'top' }); jQuery('textarea#comment').focus(function(){ jQuery('.form-allowed-tags').slideDown(); jQuery('.form-submit').slideDown(); }); jQuery('textarea#comment').blur(function(){ if(!jQuery(this).val()){ jQuery('.form-allowed-tags').slideUp(); jQuery('.form-submit').slideUp(); } }); jQuery('.woocommerce-review-link').click(function(e){ jQuery.scrollTo('.review-toggle',300); jQuery('#product-desc').removeClass('in'); jQuery('#additional-information').removeClass('in'); jQuery('#reviews').addClass('in'); e.preventDefault(); }); jQuery('#main-content').waypoint(function() { jQuery('#top-link').toggleClass('active'); },{offset:'-100%'}); jQuery('#top-link').click(function(e) { jQuery.scrollTo(0,300); e.preventDefault(); }); }, NovaAnimations: function() { jQuery('.nova-animation').each(function() { var animatedItem = jQuery(this), itemAnimation = animatedItem.data('animation'), itemDelay = animatedItem.data('delay'); animatedItem.appear(function() { if (itemAnimation == 'fade-from-left') { animatedItem.delay(itemDelay).animate({ 'opacity' : 1, 'left' : '0px' }, 600, 'easeOutCubic'); } else if (itemAnimation == 'fade-from-right') { animatedItem.delay(itemDelay).animate({ 'opacity' : 1, 'right' : '0px' }, 600, 'easeOutCubic'); } else if(itemAnimation == 'fade-from-bottom') { if (animatedItem.hasClass('image-banner-content')) { animatedItem.delay(itemDelay).animate({ 'opacity' : 1, 'bottom' : '50%' }, 1000, 'easeOutCubic'); } else { animatedItem.delay(itemDelay).animate({ 'opacity' : 1, 'bottom' : '0px' }, 600, 'easeOutCubic'); } } else if (itemAnimation == 'fade-in') { animatedItem.delay(itemDelay).animate({ 'opacity' : 1 }, 600, 'easeOutCubic'); } else if (itemAnimation == 'grow') { setTimeout(function(){ animatedItem.addClass('nova-animate'); }, itemDelay); } else { setTimeout(function() { animatedItem.addClass('nova-animate'); }, itemDelay); } }, {accX: 0, accY: -150}, 'easeInCubic'); }); }, AnimateArrow: function () { animateArrow(); }, PageLoader:function () { jQuery('.page-loader').fadeOut('fast'); }, }; ///////////////////////////////////////////// // LOAD + READY FUNCTION ///////////////////////////////////////////// var onReady = { init: function(){ header.init(); header.StickyHeader(); header.MobileMenu(); //header.MenuMain4(); header.MenuToggle(); woocommerce.init(); general.init(); shortcode.init(); portfolio.amazingfilter(); shortcode.Accordion(); shortcode.Tab(); shortcode.ButtonHover(); shortcode.IconHover(); } }; var onLoad = { init: function(){ header.MegaMenuPosition(); header.MegaMenu(); //general.AnimateArrow(); if(_page_loader) { general.PageLoader(); } } }; jQuery(document).ready(onReady.init); jQuery(window).load(onLoad.init); })(jQuery); /* =========================== */ (function ($) { "use strict"; /* Setup breakpoints for responsive JS activations */ var jRes = jRespond([ { label: 'small', enter: 0, exit: 768 },{ label: 'medium', enter: 768, exit: 980 },{ label: 'large', enter: 980, exit: 10000 } ]); /******* DESKTOP BREAKPOINT SCRIPTS ********/ jRes.addFunc({ breakpoint: ['large','medium'], enter: function() { /* Mini Cart */ jQuery('.cart-link').parent().hoverIntent( function () { jQuery(this).find('.nav-dropdown').fadeIn(50); jQuery(this).addClass('active'); }, function () { jQuery(this).find('.nav-dropdown').fadeOut(50); jQuery(this).removeClass('active'); } ); /* Search */ jQuery('.search-box-label').parent().hoverIntent( function () { jQuery(this).find('.nav-dropdown').fadeIn(50); jQuery(this).addClass('active'); }, function () { jQuery(this).find('.nav-dropdown').fadeOut(50); jQuery(this).removeClass('active'); } ); /* currency */ jQuery('.currency-link').parent().hoverIntent( function () { jQuery(this).find('.nav-dropdown').fadeIn(50); jQuery(this).addClass('active'); }, function () { jQuery(this).find('.nav-dropdown').fadeOut(50); jQuery(this).removeClass('active'); } ); /* language */ jQuery('.language-link').parent().hoverIntent( function () { jQuery(this).find('.nav-dropdown').fadeIn(50); jQuery(this).addClass('active'); }, function () { jQuery(this).find('.nav-dropdown').fadeOut(50); jQuery(this).removeClass('active'); } ); }, exit: function() { } }); })(jQuery); /* === BIG ARROW ANIMATION === */ function animateArrow() { setTimeout(function () { jQuery(".bigArrow i").css('opacity', 1).stop(true, true).animate({ opacity: 0, top: "15px" }, { queue: false, duration: 350, complete: function () { jQuery(".bigArrow i").css("top", "-15px").stop(true, true).delay(200).animate({ opacity: 1, top: 0 }, { queue: false, duration: 450, complete: function () { animateArrow(); }}) }}) }, 1800); }