Merge commit 'bfb1829a86a2bc1b595dad52a9d6dcfe80dd0679' as 'themes/codex'

This commit is contained in:
2020-12-11 02:43:08 +05:30
77 changed files with 3137 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
window.addEventListener('DOMContentLoaded', () => {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
const id = entry.target.getAttribute('id');
if (entry.intersectionRatio > 0) {
document.querySelector(`#TableOfContents ul li a[href="#${id}"]`).classList.add('active');
} else {
document.querySelector(`#TableOfContents ul li a[href="#${id}"]`).classList.remove('active');
}
});
});
// Track all headers that have an `id` applied
document.querySelectorAll('article h3[id], article h2[id]').forEach((section) => {
observer.observe(section);
});
});