{"remainingRequest":"C:\\wamp64\\www\\free-energie\\wp-content\\themes\\digitalcover\\node_modules\\babel-loader\\lib\\index.js??ruleSet[1].rules[0].use[1]!C:\\wamp64\\www\\free-energie\\wp-content\\themes\\digitalcover\\resources\\assets\\scripts\\util\\Anchor.js","dependencies":[{"path":"C:\\wamp64\\www\\free-energie\\wp-content\\themes\\digitalcover\\resources\\assets\\scripts\\util\\Anchor.js","mtime":1722418414000},{"path":"C:\\wamp64\\www\\free-energie\\wp-content\\themes\\digitalcover\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1726651497274},{"path":"C:\\wamp64\\www\\free-energie\\wp-content\\themes\\digitalcover\\node_modules\\babel-loader\\lib\\index.js","mtime":1726651482652}],"contextDependencies":[],"result":["import store from './store';\nexport default class Anchor {\n  constructor() {\n    this.offset = store.w.w > 1200 ? -150 : -75;\n    this.index = 0;\n    this.getElems();\n    this.init();\n    this.events();\n  }\n  getElems() {\n    this.$anchors = document.querySelectorAll('a[href^=\"#\"]');\n  }\n  init() {\n    this.anchors = [];\n    for (let i = 0; i < this.$anchors.length; i++) {\n      const id = this.$anchors[i].getAttribute('href');\n      if (id !== '#') {\n        const element = document.querySelector(id);\n        const anchor = document.createElement('div');\n        anchor.classList = this.$anchors[i].classList;\n        anchor.innerHTML = this.$anchors[i].innerHTML;\n        this.$anchors[i].parentNode.insertBefore(anchor, this.$anchors[i]);\n        this.$anchors[i].parentNode.removeChild(this.$anchors[i]);\n        this.anchors[this.index] = {\n          button: anchor,\n          target: element\n        };\n        this.index++;\n      }\n    }\n  }\n  events() {\n    for (let i = 0; i < this.anchors.length; i++) {\n      this.anchors[i].button.addEventListener('click', this.scrollTo.bind(this, i));\n    }\n  }\n  scrollTo(i) {\n    store.smoothScroll.scrollTo(this.anchors[i].target, {\n      offset: this.offset\n    });\n    if (store.scrollEngine === 'locomotive-scroll') store.smoothScroll.update();\n  }\n}",null]}