{"version":3,"sources":["homepage.js"],"names":["$","window","lastTime","vendors","x","length","requestAnimationFrame","cancelAnimationFrame","callback","element","currTime","Date","getTime","timeToCall","Math","max","id","setTimeout","clearTimeout","bodyHeight","globalFooterHeight","homeLocationsHeight","homeHeroHeightOffset","windowWidth","resizeTimer","$homeHero","$logoHero","find","$titleHero","$subtitleHero","$arrowHero","$headerSticky","addClass","$body","$homeLocations","$prevLocationSection","prev","$globalFooter","mobileState","rAFTicker","checkOffsets","outerHeight","innerWidth","desktopHeaderLogic","pageYOffset","removeClass","revealingFooterLogic","homepageInit","height","css","on","off","ev","preventDefault","animate","scrollTop","jQuery"],"mappings":"CAAA,SAAAA,EAAAC,GACA,cAUA,WAGA,IAFA,IAAAC,EAAA,EACAC,EAAA,CAAA,KAAA,MAAA,SAAA,KACAC,EAAA,EAAAA,EAAAD,EAAAE,SAAAJ,EAAAK,wBAAAF,EACAH,EAAAK,sBAAAL,EAAAE,EAAAC,GAAA,yBACAH,EAAAM,qBAAAN,EAAAE,EAAAC,GAAA,yBACAH,EAAAE,EAAAC,GAAA,+BAGAH,EAAAK,wBACAL,EAAAK,sBAAA,SAAAE,EAAAC,GACA,IAAAC,GAAA,IAAAC,MAAAC,UACAC,EAAAC,KAAAC,IAAA,EAAA,IAAAL,EAAAR,IACAc,EAAAf,EAAAgB,YAAA,WAAAT,EAAAE,EAAAG,EAAA,GACAA,GAEA,OADAX,EAAAQ,EAAAG,EACAG,CACA,GAEAf,EAAAM,uBACAN,EAAAM,qBAAA,SAAAS,GACAE,aAAAF,EACA,EACA,CAvBA,GA0BAhB,GAAA,WACA,IAmCAmB,EACAC,EACAC,EAEAC,EAGAC,EA+GAC,EAzJAC,EAAAzB,EAAA,kBAGA0B,EAAAD,EAAAE,KAAA,cAEAC,EAAAH,EAAAE,KAAA,sBAEAE,EAAAJ,EAAAE,KAAA,yBAEAG,EAAAL,EAAAE,KAAA,sBAoBAI,GAjBAd,YAAA,WACAS,EAAAM,SAAA,eACA,GAAA,K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r\n 'use strict';\r\n\r\n\r\n // http://paulirish.com/2011/requestanimationframe-for-smart-animating/\r\n // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating\r\n\r\n // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel\r\n\r\n // MIT license\r\n\r\n (function () {\r\n var lastTime = 0;\r\n var vendors = ['ms', 'moz', 'webkit', 'o'];\r\n for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {\r\n window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];\r\n window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame']\r\n || window[vendors[x] + 'CancelRequestAnimationFrame'];\r\n }\r\n\r\n if (!window.requestAnimationFrame)\r\n window.requestAnimationFrame = function (callback, element) {\r\n var currTime = new Date().getTime();\r\n var timeToCall = Math.max(0, 16 - (currTime - lastTime));\r\n var id = window.setTimeout(function () { callback(currTime + timeToCall); },\r\n timeToCall);\r\n lastTime = currTime + timeToCall;\r\n return id;\r\n };\r\n\r\n if (!window.cancelAnimationFrame)\r\n window.cancelAnimationFrame = function (id) {\r\n clearTimeout(id);\r\n };\r\n }());\r\n\r\n //On DOM Ready\r\n $(function () {\r\n var $homeHero = $('.section__hero'),\r\n\r\n //Element - Firm Logo \r\n $logoHero = $homeHero.find('.logo-hero'),\r\n //Element - Primary Heading\r\n $titleHero = $homeHero.find('.hero__main--title'),\r\n //Element - Secondary Heading\r\n $subtitleHero = $homeHero.find('.hero__main--subtitle'),\r\n //Element - UI Arrow\r\n $arrowHero = $homeHero.find('.hero__main--arrow');\r\n\r\n\r\n var animateLogo = setTimeout(function () {\r\n $logoHero.addClass('is-animating');\r\n }, 500);\r\n\r\n var animateTitle = setTimeout(function () {\r\n $titleHero.addClass('is-animating');\r\n }, 1500);\r\n\r\n var animateSubtitle = setTimeout(function () {\r\n $subtitleHero.addClass('is-animating');\r\n }, 1700);\r\n\r\n var animateArrow = setTimeout(function () {\r\n $arrowHero.addClass('is-animating');\r\n }, 2000);\r\n\r\n\r\n var $headerSticky = $('.global-site-nav'),\r\n $body = $('body'),\r\n $homeLocations = $('.home-locations'),\r\n $prevLocationSection = $('.home-locations').prev(),\r\n $globalFooter = $('.global-footer'),\r\n //window specific variables\r\n bodyHeight,\r\n globalFooterHeight,\r\n homeLocationsHeight,\r\n pageOffset,\r\n homeHeroHeightOffset,\r\n mobileState = false,\r\n rAFTicker = false,\r\n windowWidth;\r\n\r\n function checkOffsets() {\r\n homeHeroHeightOffset = $homeHero.outerHeight();\r\n\r\n windowWidth = window.innerWidth;\r\n\r\n (windowWidth < 768) ? mobileState = true : mobileState = false;\r\n }\r\n\r\n checkOffsets();\r\n\r\n $arrowHero.on('click.arrowScroll', function (ev) {\r\n ev.preventDefault();\r\n $('html,body').animate({\r\n scrollTop: homeHeroHeightOffset\r\n }, 800);\r\n });\r\n\r\n\r\n function calculateBodyHeight() {\r\n globalFooterHeight = $globalFooter.outerHeight();\r\n homeLocationsHeight = $homeLocations.outerHeight();\r\n bodyHeight = $body.height() / 2;\r\n\r\n $homeLocations.css('bottom', globalFooterHeight);\r\n $prevLocationSection.css('margin-bottom', globalFooterHeight + homeLocationsHeight);\r\n }\r\n\r\n function requestTicker() {\r\n if (!rAFTicker) {\r\n requestAnimationFrame(function () {\r\n desktopHeaderLogic();\r\n revealingFooterLogic();\r\n });\r\n }\r\n\r\n rAFTicker = true;\r\n }\r\n\r\n function desktopHeaderLogic() {\r\n\r\n rAFTicker = false;\r\n\r\n pageOffset = window.pageYOffset;\r\n\r\n if (pageOffset >= homeHeroHeightOffset) {\r\n //Animate Header and stick to the top of the page\r\n $headerSticky.addClass('is-fixed is-animating');\r\n\r\n\r\n }\r\n\r\n else {\r\n //hide Logo and unStickheader\r\n $headerSticky.removeClass('is-fixed is-animating');\r\n\r\n\r\n }\r\n }\r\n\r\n function revealingFooterLogic() {\r\n\r\n pageOffset = window.pageYOffset;\r\n\r\n //If we are homero, attached offset\r\n if (pageOffset > bodyHeight) {\r\n\r\n //hide Hero\r\n $homeHero.addClass('is-disabled');\r\n\r\n //add fixed class after scrolling down to naturally calculate the height of the footer and locations section\r\n $homeLocations.addClass('is-activated');\r\n $globalFooter.addClass('is-activated');\r\n }\r\n\r\n else {\r\n\r\n //reshow hero\r\n $homeHero.removeClass('is-disabled');\r\n\r\n $homeLocations.removeClass('is-activated');\r\n $globalFooter.removeClass('is-activated');\r\n }\r\n\r\n }\r\n\r\n function homepageInit() {\r\n\r\n if (mobileState === false) {\r\n\r\n calculateBodyHeight();\r\n\r\n desktopHeaderLogic();\r\n\r\n revealingFooterLogic();\r\n\r\n $(window).on('scroll.homepage', function () {\r\n requestTicker();\r\n });\r\n }\r\n\r\n else {\r\n $(window).off('scroll.homepage');\r\n }\r\n\r\n }\r\n\r\n homepageInit();\r\n\r\n\r\n var resizeTimer;\r\n\r\n $(window).on('resize', function () {\r\n clearTimeout(resizeTimer);\r\n resizeTimer = setTimeout(\r\n function () {\r\n checkOffsets();\r\n homepageInit();\r\n }, 300);\r\n });\r\n\r\n });\r\n\r\n\r\n})(jQuery, window);"]}