var body = document.querySelector('body') var menuTrigger = document.querySelector('#toggle-main-menu-mobile'); var menuContainer = document.querySelector('#main-menu-mobile'); menuTrigger.onclick = function() { menuContainer.classList.toggle('open'); menuTrigger.classList.toggle('is-active') body.classList.toggle('lock-scroll') } var content = document.querySelector('.content.anchor-link-enabled') if (content) { addHeaderAnchors(content); } function addHeaderAnchors(content) { var headers = content.querySelectorAll('h1, h2, h3, h4'); // SVG data from https://iconmonstr.com/link-1-svg/ var linkSvg = ' '; var anchorForId = function (id) { var anchor = document.createElement('a'); anchor.classList.add('header-anchor'); anchor.href = "#" + id; anchor.innerHTML = linkSvg; return anchor; }; for (var h = 0; h < headers.length; h++) { var header = headers[h]; if (typeof header.id !== "undefined" && header.id !== "") { header.appendChild(anchorForId(header.id)); } } }