{"version":3,"file":"accordion.7bb5d29e8eadb6412aa6.js","mappings":"mBAEAA,SAASC,iBAAiB,oBAAoB,MCFvC,WACH,MAAMC,EAAQF,SAASG,iBAAiB,gBAGxC,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAMG,OAAQD,IAAK,CACnC,MACME,EADQJ,EAAME,GAAGG,cAAc,qBACZC,aACzBN,EAAME,GAAGK,MAAMC,OAAU,GAAEJ,MA+B/B,SAASK,EAAYC,GAEjB,OADcA,EAAKL,cAAc,qBACpBC,aA9BjBN,EAAMW,SAAQD,IACIA,EAAKL,cAAc,qBAC3BN,iBAAiB,SAAS,KAC5B,MACMa,EADUF,EAAKL,cAAc,uBACLC,aAAe,EACvCF,EAAaK,EAAYC,GAavC,IAAeG,EAXHH,EAAKI,UAAUC,SAAS,QACxBL,EAAKH,MAAMC,OAAU,GAAEJ,OAUpBS,EARGH,EASdV,EAAMW,SAAQD,IACV,GAAIG,IAAYH,EAAM,CAClB,MAAMN,EAAaK,EAAYC,GAC/BA,EAAKI,UAAUE,OAAO,QACtBN,EAAKH,MAAMC,OAAU,GAAEJ,UAZvBM,EAAKH,MAAMC,OAAU,GAAEI,EAAgBR,OAG3CM,EAAKI,UAAUG,OAAO,cDrB9BC,O","sources":["webpack://globus/./src/scripts/accordion.js","webpack://globus/./src/scripts/modules/accardion.js"],"sourcesContent":["import {accardion} from \"./modules/accardion\";\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n accardion();\n});\n","export function accardion() {\n const cards = document.querySelectorAll(\".accardionJs\");\n\n // eslint-disable-next-line immutable/no-let\n for (let i = 0; i < cards.length; i++) {\n const title = cards[i].querySelector(\".accardion__title\");\n const itemHeight = title.offsetHeight;\n cards[i].style.height = `${itemHeight}px`;\n }\n\n cards.forEach(item => {\n const title = item.querySelector(\".accardion__title\");\n title.addEventListener(\"click\", () => {\n const content = item.querySelector(\".accardionContentJs\");\n const contentHeight = content.offsetHeight - 4;\n const itemHeight = heightTitle(item);\n\n if (item.classList.contains(\"open\")) {\n item.style.height = `${itemHeight}px`;\n } else {\n close(item);\n item.style.height = `${contentHeight + itemHeight}px`;\n }\n\n item.classList.toggle(\"open\");\n });\n });\n\n function close(opening) {\n cards.forEach(item => {\n if (opening !== item) {\n const itemHeight = heightTitle(item);\n item.classList.remove(\"open\");\n item.style.height = `${itemHeight}px`;\n }\n });\n }\n\n function heightTitle(item) {\n const title = item.querySelector(\".accardion__title\");\n return title.offsetHeight;\n }\n}\n"],"names":["document","addEventListener","cards","querySelectorAll","i","length","itemHeight","querySelector","offsetHeight","style","height","heightTitle","item","forEach","contentHeight","opening","classList","contains","remove","toggle","accardion"],"sourceRoot":""}