/* LOADER */ /* global Parallax */ jQuery(document).ready(function(){ var zerif_frame = jQuery('iframe.zerif_google_map'); var zerif_frameSrc = []; if( zerif_frame.length ){ jQuery.each( zerif_frame, function(i, f){ zerif_frameSrc[i] = jQuery(f).attr('src'); /*remove the src attribute so window will ignore these iframes*/ jQuery(f).attr('src', ''); }); } function zerif_display_iframe_map() { if( zerif_frame.length ){ jQuery.each( zerif_frame, function(a, x){ /*put the src attribute value back*/ jQuery(x).attr('src', zerif_frameSrc[a]); }); } } jQuery('.status').fadeOut(); jQuery('.preloader').delay(1000).fadeOut('slow'); setTimeout(zerif_display_iframe_map, 500); var modalClick, iframe, video; jQuery( '.zerif-with-modal' ).click( function() { modalClick = jQuery( this ); jQuery( 'html' ).css( 'overflow', 'hidden' ); modalClick.parent().find( '.zerif-modal-wrap' ).css( 'display', 'block' ); if( modalClick.parent().find( '.zerif-modal-wrap iframe' ).length > 0 ) { iframe = modalClick.parent().find('.zerif-modal-wrap iframe'); } else { iframe = (function () { return; })(); // set iframe variable as undefined } if( modalClick.parent().find( '.zerif-modal-wrap video' ).length > 0 ) { video = modalClick.parent().find('.zerif-modal-wrap video' ); } else { video = (function () { return; })(); } if( typeof iframe !== 'undefined' && iframe.attr( 'src' ) === '' ) { iframe.attr('src', iframe.attr('data-src')); } } ); jQuery( '.zerif-close-modal, .zerif-close-modal-button' ).click( function() { jQuery( 'html' ).css( 'overflow-y', 'scroll' ); jQuery( '.zerif-modal-wrap' ).css( 'display', 'none' ); if( typeof video !== 'undefined' ) { video.get(0).stop(); video.get(0).currentTime = 0; } if( typeof iframe !== 'undefined' ) { iframe.attr('data-src', iframe.attr('src')).attr('src', ''); } } ); }); /** BACKGROUND SLIDER ***/ jQuery(document).ready(function(){ if ( jQuery('.fadein-slider .slide-item').length > 1 ) { jQuery('.fadein-slider .slide-item:gt(0)').hide(); setInterval(function(){ jQuery('.fadein-slider :first-child').fadeOut(2000).next('.slide-item').fadeIn(2000).end().appendTo('.fadein-slider'); }, 10000); } }); /* RESPONSIVE BACKGROUND ON MOBILE */ var portraitViewInit = 0, // Initial viewport orientation: Default Landscape resize = false; jQuery( document ).ready( zerif_bg_responsive ); jQuery( window ).resize( zerif_bg_responsive ); function zerif_bg_responsive() { if( jQuery( '#mobile-bg-responsive' ).length > 0 && jQuery( 'body.custom-background' ).length > 0 && isMobile.any() ) { // There is background image var windowWidth = window.innerWidth; var windowHeight = window.innerHeight; // Check if orientation is Portrait or Landscape: Default is Landscape var portraitView = 0; if( windowHeight >= windowWidth ) { portraitView = 1; } if( isMobile.iOS() ) { windowHeight+=100; } if( portraitViewInit !== portraitView ) { var bgHelper = jQuery( '.zerif-mobile-bg-helper-bg' ); if( !resize ) { var imgURL = jQuery( 'body.custom-background' ).css( 'background-image' ); jQuery( '.zerif-mobile-bg-helper-bg-inside' ).css( { 'background-image': imgURL, } ).addClass( 'zerif-mobile-h-inside' ); jQuery( '.zerif-mobile-bg-helper-wrap-all' ).addClass( 'zerif-mobile-h-all' ); jQuery( '.zerif-mobile-bg-helper-content' ).addClass( 'zerif-mobile-h-content' ); bgHelper.css( { 'width': windowWidth, 'height': windowHeight } ).addClass( 'zerif-mobile-h-bg' ); portraitViewInit = portraitView; resize = true; } else { // Resize window bgHelper.css( { 'width': windowWidth, 'height': windowHeight } ); portraitViewInit = portraitView; } } } } /*** DROPDOWN FOR MOBILE MENU */ var zerif_callback_mobile_dropdown = function () { if( jQuery( '.wr-megamenu-container' ).length <= 0 && jQuery( '.mega-menu-wrap' ).length <= 0 ) { var navLi = jQuery('#site-navigation li'); navLi.each(function(){ if ( jQuery(this).find('ul').length > 0 && !jQuery(this).hasClass('has_children') ){ jQuery(this).addClass('has_children'); jQuery(this).find('a').first().after('
'); } }); jQuery('.dropdownmenu').click(function(){ if( jQuery(this).parent('li').hasClass('this-open') ){ jQuery(this).parent('li').removeClass('this-open'); }else{ jQuery(this).parent('li').addClass('this-open'); } }); navLi.find('a').click(function(){ jQuery('#site-navigation').parent().find('.navbar-toggle').addClass('collapsed'); jQuery('#site-navigation').parent().find('.collapse').removeClass('in'); }); } }; jQuery(document).ready(zerif_callback_mobile_dropdown); /* show/hide reCaptcha */ jQuery(document).ready(function() { var thisOpen = false; jQuery('.contact-form .form-control').each(function(){ if ( (typeof jQuery(this).val() !== 'undefined') && (jQuery(this).val().length > 0) ){ thisOpen = true; jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1'); return false; } }); if ( thisOpen === false && (typeof jQuery('.contact-form textarea').val() !== 'undefined') && (jQuery('.contact-form textarea').val().length > 0) ) { thisOpen = true; jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1'); } jQuery('.contact-form input, .contact-form textarea').focus(function(){ if ( !jQuery('.zerif-g-recaptcha').hasClass('recaptcha-display') ) { jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1'); } }); }); /* Bootstrap Fix */ if (navigator.userAgent.match(/IEMobile\/10\.0/)) { var msViewportStyle = document.createElement('style'); msViewportStyle.appendChild( document.createTextNode( '@-ms-viewport{width:auto!important}' ) ); document.querySelector('head').appendChild(msViewportStyle); } jQuery(document).ready(function() { /* PARALLAX */ var jQuerywindow = jQuery(window); jQuery('div[data-type="background"], header[data-type="background"], section[data-type="background"]').each(function(){ var jQuerybgobj = jQuery(this); jQuery(window).scroll(function() { var yPos = -(jQuerywindow.scrollTop() / jQuerybgobj.data('speed')); var coords = '50% '+ yPos + 'px'; jQuerybgobj.css({ backgroundPosition: coords }); }); }); }); /*================================= === SMOOTH SCROLL ==== =================================== */ jQuery(document).ready(function(){ jQuery('#site-navigation a[href*="#"]:not([href="#"]), .navbar.navbar-inverse .primary-menu a[href*="#"]:not([href="#"]), header.header a[href*="#"]:not([href="#"])').bind('click',function () { var headerHeight; var hash = this.hash; var idName = hash.substring(1); // get id name var alink = this; // this button pressed // check if there is a section that had same id as the button pressed if ( jQuery('section [id*=' + idName + ']').length > 0 && jQuery(window).width() >= 751 ){ jQuery('#site-navigation .current, .navbar.navbar-inverse .primary-menu .current').removeClass('current'); jQuery(alink).parent('li').addClass('current'); }else{ jQuery('#site-navigation .current, .navbar.navbar-inverse .primary-menu .current').removeClass('current'); } if ( jQuery(window).width() >= 751 ) { headerHeight = jQuery('#main-nav').height(); } else { headerHeight = 0; } if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) { var target = jQuery(this.hash); target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']'); if (target.length) { jQuery('html,body').animate({ scrollTop: target.offset().top - headerHeight + 5 }, 1200); // Close dropdown menu on mobile, after an anchor is clicked if( jQuery( '.navbar .navbar-collapse' ).hasClass( 'in' ) ) { jQuery( '.navbar .navbar-collapse.in' ).removeClass( 'in' ); } if ( jQuery( '.navbar li.dropdown' ).hasClass( 'open' ) ) { jQuery( '.navbar li.dropdown.open' ).removeClass( 'open' ); } return false; } } }); }); jQuery(document).ready(function(){ var headerHeight; jQuery('#site-navigation .current, .navbar.navbar-inverse .primary-menu .current').removeClass('current'); jQuery('#site-navigation a[href$="' + window.location.hash + '"], .navbar.navbar-inverse .primary-menu a[href$="' + window.location.hash + '"]').parent('li').addClass('current'); if ( jQuery(window).width() >= 751 ) { headerHeight = jQuery('#main-nav').height(); } else { headerHeight = 0; } if (location.pathname.replace(/^\//,'') === window.location.pathname.replace(/^\//,'') && location.hostname === window.location.hostname) { var target = jQuery(window.location.hash); if (target.length) { jQuery('html,body').animate({ scrollTop: target.offset().top - headerHeight + 5 }, 1200); return false; } } }); /* TOP NAVIGATION MENU SELECTED ITEMS */ function zerif_scrolled() { if ( jQuery(window).width() >= 751 ) { var zerif_scrollTop = jQuery(window).scrollTop(); // cursor position var headerHeight = jQuery('#main-nav').outerHeight(); // header height var isInOneSection = 'no'; // used for checking if the cursor is in one section or not // for all sections check if the cursor is inside a section jQuery('section, header').each( function() { var thisID = '#' + jQuery(this).attr('id'); // section id var zerif_offset = jQuery(this).offset().top; // distance between top and our section var thisHeight = jQuery(this).outerHeight(); // section height var thisBegin = zerif_offset - headerHeight; // where the section begins var thisEnd = zerif_offset + thisHeight - headerHeight; // where the section ends // if position of the cursor is inside of the this section if ( zerif_scrollTop >= thisBegin && zerif_scrollTop <= thisEnd ) { isInOneSection = 'yes'; jQuery('#site-navigation .current, .navbar.navbar-inverse .primary-menu .current').removeClass('current'); jQuery('#site-navigation a[href$="' + thisID + '"], .navbar.navbar-inverse .primary-menu a[href$="' + thisID + '"]').parent('li').addClass('current'); // find the menu button with the same ID section return false; } if (isInOneSection === 'no') { jQuery('#site-navigation .current, .navbar.navbar-inverse .primary-menu .current').removeClass('current'); } }); } } jQuery(window).on('scroll',zerif_scrolled); jQuery(window).load(function() { /* SUBSCRIBE */ jQuery('form :input').each(function(index, elem) { var eId = jQuery(elem).attr('class'); if( (eId === 'sib-email-area') || (eId === 'sib-NAME-area') ) { var label = null; if (eId && (label = jQuery(elem).parents('form').find('label.'+eId)).length === 1) { jQuery(elem).attr('placeholder', jQuery(label).html()); jQuery(label).remove(); } } }); }); /* TOP NAVIGATION MENU SELECTED ITEMS */ jQuery(window).scroll(function(){ var zerif_scrollTop = jQuery(window).scrollTop(); var zerif_windowHeight = jQuery(window).height(); jQuery('section').each( function() { var zerif_offset = jQuery(this).offset(); if (zerif_scrollTop <= zerif_offset.top && (jQuery(this).height() + zerif_offset.top) < (zerif_scrollTop + zerif_windowHeight) ) { jQuery('ul.nav > li a').each( function() { jQuery(this).removeClass('nav-active'); }); var zerif_current_id_visible = jQuery(this).attr('id'); jQuery('ul.nav > li a').each( function() { if( jQuery(this).attr('href') ) { if( jQuery(this).attr('href').indexOf(zerif_current_id_visible) >= 0 ) { jQuery('ul.nav > li a').each( function() { jQuery(this).removeClass('nav-active'); }); jQuery(this).addClass('nav-active'); } } }); } }); }); /* SETS THE HEIGHT OF THE HEADER */ jQuery(window).load(function(){ setminHeightHeader(); }); jQuery(window).resize(function() { setminHeightHeader(); }); function setminHeightHeader() { if ( jQuery('#main-nav').css('min-height') !== 75 || jQuery('.header').css('min-height') !== 75 ) { jQuery('#main-nav').css('min-height',75); jQuery('.header').css('min-height',75); } if ( jQuery(window).width() > 750 ) { var minHeight = parseInt( jQuery('#main-nav').height() ); jQuery('#main-nav').css('min-height',minHeight); jQuery('.header').css('min-height',minHeight); } } /* - */ /* STICKY FOOTER */ jQuery(window).load(function(){ fixFooterBottom(); }); jQuery(window).resize(function() { fixFooterBottom(); }); function fixFooterBottom(){ var header = jQuery('header.header'); var footer = jQuery('footer#footer'); var content = jQuery('.site-content > .container'); content.css('min-height', '1px'); var headerHeight = header.outerHeight(); var footerHeight = footer.outerHeight(); var contentHeight = content.outerHeight(); var windowHeight = jQuery(window).height(); var totalHeight = headerHeight + footerHeight + contentHeight; if (totalHeight