We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 375326b commit 2680e84Copy full SHA for 2680e84
1 file changed
src/generators/legacy-html/assets/api.js
@@ -203,18 +203,19 @@ const setupCopyButton = () => {
203
function setupSidebarScroll() {
204
const sidebarLinks = document.querySelectorAll('#column2 a');
205
206
- let link;
207
- for (link of sidebarLinks) {
+ let activeLink = null;
+ for (const link of sidebarLinks) {
208
if (link.pathname === window.location.pathname) {
209
+ activeLink = link;
210
break;
211
}
212
213
- if (!link) {
214
+ if (!activeLink) {
215
return;
216
217
- link.scrollIntoView({ behavior: 'smooth', block: 'center' });
218
+ activeLink.scrollIntoView({ behavior: 'smooth', block: 'center' });
219
220
221
// Initialize either on DOMContentLoaded or immediately if already loaded
0 commit comments