Skip to content

Commit

Permalink
Second fix for table-of-contents scroll jitter. Previous fix introduc…
Browse files Browse the repository at this point in the history
…ed another issue where the scroll suddenly stopped when scrolling downwards. Realized I can just scroll the anchor into view instead of the whole list element. This makes the original problem go away. Removed the smooth scrolling since it caused issues.
  • Loading branch information
karl-zylinski committed Aug 28, 2024
1 parent f1db1d5 commit 2c72477
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion themes/odin/static/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ window.addEventListener('DOMContentLoaded', () => {

var anchor = document.querySelector(`nav li a[href="#${id}"]`);
anchor.parentElement.classList.add('active');
anchor.parentElement.scrollIntoView({ block: "nearest", behavior: "smooth" });
anchor.scrollIntoView({ block: "nearest" });
}
}
})
Expand Down

0 comments on commit 2c72477

Please sign in to comment.