{"version":3,"file":"Accordion.ScrollFix.js","sources":["Accordion.ScrollFix.js"],"sourcesContent":["/*==============================================================================================================================\r\n| Author Ignia, LLC\r\n| Client GoldSim\r\n| Project Website\r\n\\=============================================================================================================================*/\r\n\r\n/**\r\n * ACCORDION: SCROLL FIX\r\n * @file By default, when the accordion expands, it doesn't scroll the page. This can cause problem with longer accordion\r\n * content, however, since any previous panels will collapse. As a result, the top of the panel that was just opened may not be\r\n * visible—and, in fact, the entire panel may not even be visible in some extreme scenarios. To mitigate this, this script will\r\n * automatically scroll to the top of the panel that was just opened. It does this by projecting where the top of the panel will\r\n * be so that it can animate to that location in parallel to the accordion animation for toggling panel visibility. This is\r\n * preferred to doing this sequentially, which would otherwise have the effect of slowing down the transition, or resulting in\r\n * an abrupt jump at the end.\r\n */\r\n;(function(window, document, goldSimWeb, $, undefined) {\r\n\r\n /*============================================================================================================================\r\n | JQUERY: WIRE UP ACTIONS\r\n \\---------------------------------------------------------------------------------------------------------------------------*/\r\n $(document).ready(function() {\r\n\r\n /*--------------------------------------------------------------------------------------------------------------------------\r\n | Establish variables\r\n \\-------------------------------------------------------------------------------------------------------------------------*/\r\n var _previousAccordion = null;\r\n var _previousAccordionItem = null;\r\n var _previousHeight = 0;\r\n var _previousTop = window.innerHeight;\r\n var _headerHeight = $(\"#PrimaryNavigation\").height();\r\n\r\n /*--------------------------------------------------------------------------------------------------------------------------\r\n | Initialize variables on open\r\n \\-------------------------------------------------------------------------------------------------------------------------*/\r\n $(\".accordion\").on(\"down.zf.accordion\", function (event) {\r\n _previousAccordion = $(this);\r\n _previousAccordionItem = $(this).find(\".is-active .accordion-content\");\r\n _previousHeight = _previousAccordionItem.innerHeight();\r\n _previousTop = _previousAccordionItem.offset().top;\r\n });\r\n\r\n /*--------------------------------------------------------------------------------------------------------------------------\r\n | Scroll to the projected top of the panel\r\n \\-------------------------------------------------------------------------------------------------------------------------*/\r\n $(\"li.accordion-item\").on(\"click\", function (event) {\r\n var accordionItem = $(this);\r\n var top = $(accordionItem).offset().top;\r\n var offset = 0;\r\n if (!accordionItem.hasClass(\"is-active\")) {\r\n _previousTop = window.innerHeight;\r\n return;\r\n }\r\n if (_previousAccordion && _previousTop < top && _previousAccordion.has(accordionItem).length) {\r\n offset = _previousHeight;\r\n }\r\n $('html,body').animate({ scrollTop: top - offset - _headerHeight}, 'fast');\r\n setTimeout(\r\n function () {\r\n $('html,body').animate({ scrollTop: top - offset - _headerHeight}, 'fast');\r\n },\r\n 200\r\n );\r\n });\r\n\r\n });\r\n\r\n}(window, document, window.goldSimWeb = window.goldSimWeb || {}, jQuery));"],"names":["window","document","$","ready","_previousAccordion","_previousAccordionItem","_previousHeight","_previousTop","innerHeight","_headerHeight","height","on","event","this","find","offset","top","accordionItem","hasClass","has","length","animate","scrollTop","setTimeout","goldSimWeb","jQuery"],"mappings":"AAgBC,CAAC,SAASA,EAAQC,EAAsBC,GAKvCA,EAAED,CAAQ,EAAEE,MAAM,WAKhB,IAAIC,EAA0B,KAC1BC,EAA0B,KAC1BC,EAA0B,EAC1BC,EAA0BP,EAAOQ,YACjCC,EAA0BP,EAAE,oBAAoB,EAAEQ,OAAO,EAK7DR,EAAE,YAAY,EAAES,GAAG,oBAAqB,SAAUC,GAChDR,EAA4BF,EAAEW,IAAI,EAClCR,EAA4BH,EAAEW,IAAI,EAAEC,KAAK,+BAA+B,EACxER,EAA4BD,EAAuBG,YAAY,EAC/DD,EAA4BF,EAAuBU,OAAO,EAAEC,GAC9D,CAAC,EAKDd,EAAE,mBAAmB,EAAES,GAAG,QAAS,SAAUC,GAC3C,IAAIK,EAAwBf,EAAEW,IAAI,EAC9BG,EAAwBd,EAAEe,CAAa,EAAEF,OAAO,EAAEC,IAClDD,EAAwB,EACvBE,EAAcC,SAAS,WAAW,GAInCd,GAAsBG,EAAeS,GAAOZ,EAAmBe,IAAIF,CAAa,EAAEG,SACpFL,EAA0BT,GAE5BJ,EAAE,WAAW,EAAEmB,QAAQ,CAAEC,UAAWN,EAAMD,EAASN,CAAa,EAAG,MAAM,EACzEc,WACE,WACErB,EAAE,WAAW,EAAEmB,QAAQ,CAAEC,UAAWN,EAAMD,EAASN,CAAa,EAAG,MAAM,CAC3E,EACA,GACF,GAZEF,EAA0BP,EAAOQ,WAarC,CAAC,CAEH,CAAC,CAEH,EAAER,OAAQC,UAAUD,OAAOwB,WAAaxB,OAAOwB,YAAc,GAAIC,OAAO"}