{ "version": 3, "sources": ["../../src/scripts/sticky-nav.js"], "sourcesContent": ["/*globals jQuery:false */\njQuery(document).ready(function () {\n\tconst stickyNavs = document.querySelectorAll(\".sticky-nav\");\n\n\t/**\n\t * add a class to position:sticky nav when it is in the stuck position\n\t * otherwise position:sticky elements cannot have styles unique to stuck state\n\t * see: https://css-tricks.com/how-to-detect-when-a-sticky-element-gets-pinned/\n\t */\n\tconst observerCallback = (entries) => {\n\t\tentries.forEach((entry) => {\n\t\t\tentry.target.classList.toggle(\"is-stuck\", entry.intersectionRatio < 1);\n\t\t});\n\t};\n\n\tconst observer = new IntersectionObserver(observerCallback, { threshold: [1] });\n\n\tstickyNavs.forEach((el) => {\n\t\tobserver.observe(el);\n\n\t\t/**\n\t\t * add a click handler to the first link in the nav to add class to open on mobile\n\t\t * dependent on class sticky-nav--first-anchor-toggle\n\t\t */\n\t\t/*if ( (' ' + el.className + ' ').indexOf(' sticky-nav--first-anchor-toggle ') > -1 ) {\n\t\t\tel.querySelector('a').addEventListener('click', evt => {\n\t\t\t\tevt.preventDefault();\n\t\t\t\tel.classList.toggle('is-open');\n\t\t\t});\n\t\t}*/\n\n\t\t/**\n\t\t * add a click handler to the current menu item to add class to open menu on mobile\n\t\t */\n\t\tel.querySelector(\"li.current--item a\").addEventListener(\"click\", (evt) => {\n\t\t\tevt.preventDefault();\n\t\t\tel.classList.toggle(\"is-open\");\n\t\t});\n\t});\n\n\t/**\n\t * Back To Top\n\t */\n\tjQuery(\".sticky-nav--back-to-top\").click(() => jQuery(window).scrollTop());\n});\n"], "mappings": "MACA,OAAO,QAAQ,EAAE,MAAM,UAAY,CAClC,IAAMA,EAAa,SAAS,iBAAiB,aAAa,EAOpDC,EAAoBC,GAAY,CACrCA,EAAQ,QAASC,GAAU,CAC1BA,EAAM,OAAO,UAAU,OAAO,WAAYA,EAAM,kBAAoB,CAAC,CACtE,CAAC,CACF,EAEMC,EAAW,IAAI,qBAAqBH,EAAkB,CAAE,UAAW,CAAC,CAAC,CAAE,CAAC,EAE9ED,EAAW,QAASK,GAAO,CAC1BD,EAAS,QAAQC,CAAE,EAgBnBA,EAAG,cAAc,oBAAoB,EAAE,iBAAiB,QAAUC,GAAQ,CACzEA,EAAI,eAAe,EACnBD,EAAG,UAAU,OAAO,SAAS,CAC9B,CAAC,CACF,CAAC,EAKD,OAAO,0BAA0B,EAAE,MAAM,IAAM,OAAO,MAAM,EAAE,UAAU,CAAC,CAC1E,CAAC", "names": ["stickyNavs", "observerCallback", "entries", "entry", "observer", "el", "evt"] }