assets/entry-parser.js in jekyll-ham-1.0.1 vs assets/entry-parser.js in jekyll-ham-1.0.2

- old
+ new

@@ -59,16 +59,18 @@ var newLi = document.createElement('li'); newLi.className = 'list-group-item'; var newA = document.createElement('a'); newA.href = '#' + node.id; newA.className = 'nav-link text-truncate'; - newA.setAttribute('onclick', 'expandAccordion(\'' + currentAccordionId + '\')'); + newA.setAttribute('data-bs-dismiss', 'offcanvas'); + newA.setAttribute('data-bs-target', '#_ham_sidebar'); + newA.setAttribute('onclick', 'expandAccordion(\'' + currentAccordionId + '\', \'' + node.id + '\')'); for (j = 2; j < currentHeadingLevel; j++){ var newSpan = document.createElement('span'); if (j == currentHeadingLevel - 1) { newSpan.className = 'me-1 d-inline-block text-body-tertiary'; - newSpan.textContent = '↳'; + newSpan.innerHTML = '<i class="bi bi-arrow-return-right"></i>'; } else { newSpan.className = 'ms-3 d-inline-block'; } newSpan.setAttribute('aria-hidden', true); newA.appendChild(newSpan); @@ -191,11 +193,16 @@ }); _ham_state_is_all_accordion_collapsed = true; } } -async function expandAccordion(id){ - var el = new bootstrap.Collapse(document.getElementById(id + "-content"), {toggle: false}); +async function expandAccordion(collapsibleId, contentId){ + var el = new bootstrap.Collapse(document.getElementById(collapsibleId + "-content"), {toggle: false}); await el.show(); + if (contentId) { + location.hash = ""; + location.hash = "#" + contentId; + scrollBy(0, -66); + } } window.addEventListener("load", autoexpandAccordion); \ No newline at end of file