/* global-animation.js =================== This file is included in inc-htmlbottom.php if animations are enabled. Please only place animations that are to be site wide in this file, otherwise please place Remember that animations are theme specific, meaning this file only effects the current theme that you are animating, and not every theme across the TemplateOTS platform. See detailed documentation here:- https://docs.google.com/document/d/1n5sWQ8SIr-zjOpTv8YnOTHJapO8WdedjDfbeo-lkqMM/edit#heading=h.lmxb59mpcpe2 */ (function () { /* Store a global animation delay that will be used to delay animations */ var nGlobalAnimationDelay = 0; /* On Document Loaded ================== Called by Jquery event handler when the document is ready (When content has been loaded) */ $( document ).ready( function() { // Call the fade website in animation to fade the website in! fFadeWebsiteIn(); // Try and store the top header var oTopHeader = $(".top-header-wrapper"); // Try and store the middle header var oMiddleHeader = $(".middle-header-wrapper"); // Try and store the bottom header var oBottomHeader = $(".bottom-header-wrapper"); // If we can find the full overlay if( $("#full-overlay").length ) { // Set the global animation delay nGlobalAnimationDelay = 1.7; } // Animate the header fAnimateHeader(oTopHeader, oMiddleHeader, oBottomHeader); }); /* fFadeWebsiteIn() ================ This function is called when the website first loads, it simply fades the header container in */ function fFadeWebsiteIn() { // Fade the body in TweenMax.to("body", 0.7, { opacity : 1, ease : Power2.easeIn } ); } /* fAnimateHeader() ================ Animates the header of the website (Navigation, logo etc) */ function fAnimateHeader(oTopHeader, oMiddleHeader, oBottomHeader) { // Store the header animation speed var nHeaderAnimationSpeed = 0.3; // Store the animation delay var nHeaderAnimationDelay = nGlobalAnimationDelay; // If the middle header exists if( oMiddleHeader.length ) { // Animate the header TweenMax.to( oMiddleHeader, 0.25, { opacity : 1, delay : nHeaderAnimationDelay, ease : Power2.easeIn }); // Increase the animation delay nHeaderAnimationDelay += 0.1; } // If the top header exists if( oTopHeader.length ) { // Animate the header TweenMax.to( oTopHeader, nHeaderAnimationSpeed, { opacity : 1, delay : nHeaderAnimationDelay, ease : Power2.easeIn }); // Increase the animation delay nHeaderAnimationDelay += 0.1; } // If the bottom header exists if( oBottomHeader.length ) { // Animate the header TweenMax.to( oBottomHeader, nHeaderAnimationSpeed, { opacity : 1, delay : nHeaderAnimationDelay, ease : Power2.easeIn }); // Increase the animation delay nHeaderAnimationDelay += 0.1; } } }());