Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/generators/legacy-html/assets/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,19 @@ const setupCopyButton = () => {
function setupSidebarScroll() {
const sidebarLinks = document.querySelectorAll('#column2 a');

let link;
for (link of sidebarLinks) {
let activeLink = null;
for (const link of sidebarLinks) {
if (link.pathname === window.location.pathname) {
activeLink = link;
break;
}
}

if (!link) {
if (!activeLink) {
return;
Comment thread
avivkeller marked this conversation as resolved.
}

link.scrollIntoView({ behavior: 'smooth', block: 'center' });
activeLink.scrollIntoView({ behavior: 'smooth', block: 'center' });
}

// Initialize either on DOMContentLoaded or immediately if already loaded
Expand Down
Loading