{"version":3,"names":[],"mappings":"","sources":["stickynav.js"],"sourcesContent":["(function($) {\n var stickySubnav = {\n animCtrl: new ScrollMagic.Controller(),\n wrapperQuery: '.post-subnav__wrapper',\n $wrapperEl: undefined,\n $navEl: $('.post-subnav__nav'),\n $navLinks: undefined,\n $subSections: $('.post-subsection, #subsection-news_events'),\n scenes: {\n sticky: undefined,\n active: [],\n },\n highlightNavItem: function($item) {\n this.$navLinks.removeClass('active');\n if ($item && $item.length) $item.addClass('active');\n },\n trackActive: function() {\n var ctrl = this;\n this.$subSections.each(function(s) {\n var id = '#' + this.id;\n var subScene = new ScrollMagic.Scene({\n triggerElement: id,\n triggerHook: 0.5,\n }).addTo(ctrl.animCtrl);\n subScene.on('enter', function(e) {\n if (e.scrollDirection === 'FORWARD') {\n ctrl.highlightNavItem(\n $(ctrl.$navLinks.filter(\"[href='\" + id + \"']\"))\n );\n }\n });\n subScene.on('leave', function(e) {\n if (e.scrollDirection === 'REVERSE') {\n ctrl.highlightNavItem($(ctrl.$navLinks[s - 1]));\n }\n });\n });\n },\n trackSticky: function() {\n this.scenes.sticky = new ScrollMagic.Scene({\n triggerElement: this.wrapperQuery,\n triggerHook: 0,\n })\n .setPin(this.wrapperQuery, { pushFollowers: true })\n .setClassToggle(this.wrapperQuery, 'sticky')\n .addTo(this.animCtrl);\n },\n trackReduced: function() {\n this.scenes.sticky = new ScrollMagic.Scene({\n triggerElement: this.wrapperQuery,\n triggerHook: 0,\n offset: this.$wrapperEl.height() - 88,\n })\n .setPin(this.wrapperQuery, { pushFollowers: true })\n .setClassToggle(this.wrapperQuery, 'reduced')\n .addTo(this.animCtrl);\n },\n init: function() {\n this.$navLinks = this.$navEl.find('a');\n if (this.$navLinks.length) {\n this.$wrapperEl = $(this.wrapperQuery);\n this.trackSticky();\n this.trackReduced();\n this.trackActive();\n }\n return this;\n },\n }.init();\n})(jQuery);\n"],"file":"stickynav.js"}