32 lines
1.5 KiB
JavaScript
32 lines
1.5 KiB
JavaScript
window.addEventListener('scroll', function(e) {
|
|
if (document.querySelector('body').clientWidth > 1024) {
|
|
let rightcolumn = document.querySelector('.rightcolumn');
|
|
let topicstitle = document.querySelector('.topicstitle')
|
|
let topicbar = document.querySelector('.topicbar')
|
|
let grid = document.querySelector('.grid')
|
|
let gridrect = topicstitle.getBoundingClientRect();
|
|
if (gridrect.top < 20 && !grid.classList.contains('moved')) {
|
|
grid.classList.add('moved');
|
|
topicbar.style.display = "inline";
|
|
topicstitle.style.visibility = "hidden";
|
|
grid.style.display = "none";
|
|
window.scrollBy({top: grid.clientHeight + topicstitle.clientHeight, behavior: 'smooth'})
|
|
} else if (gridrect.top > 21 && grid.classList.contains('moved')) {
|
|
grid.classList.remove('moved');
|
|
topicstitle.style.visibility = "visible";
|
|
topicbar.style.display = "none";
|
|
grid.style.display = "grid";
|
|
window.scroll({top: 0, behavior: 'smooth'})
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
window.addEventListener('DOMContentLoaded', (e) => {
|
|
let par = document.querySelector("#TableOfContents > ol:first-child > li:first-child");
|
|
let s = document.createElement("span");
|
|
s.appendChild(par.cloneNode(true))
|
|
par.remove()
|
|
document.querySelector("#TableOfContents > ol:first-child").insertBefore(s, document.querySelector("#TableOfContents > ol:first-child").firstChild)
|
|
})
|