blob: 42abcda8533b5ed45b3f95bd8e1ff01bf176816b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<script>
// Global ToC
/*
- Deploy current submenu (if any) and reploy others.
- Fixed ToC when user scrolls.
*/
document.addEventListener("DOMContentLoaded", function() {
var menusTriggers = document.getElementsByClassName("deploySubMenu");
var activeDocPage = document.getElementsByClassName("activePage")[0];
for (var i = 0; i < menusTriggers.length; i++) {
menusTriggers[i].checked = true;
}
let parentMenu = activeDocPage.parentElement.parentElement;
// Check if current page is the parent submenu page or just a child
if (parentMenu.classList.contains('subMenu')) { // child
parentMenu.previousElementSibling.previousElementSibling.checked = false;
} else { // parent
activeDocPage.nextElementSibling.checked = false;
}
});
window.addEventListener('scroll', function() {
if (document.body.clientWidth >= 1280) {
if (window.scrollY >= menuBarHeight) {
document.getElementById('main-toc-menu').classList.add('fixed', 'top-0', 'left-0');
document.getElementById('main-toc-menu').style.width = mainTocMenuWidth + 'px';
} else {
document.getElementById('main-toc-menu').classList.remove('fixed', 'top-0', 'left-0');
}
} else {
}
});
</script>
|