mirror of
https://github.com/Juicysteak117/pghrt.git
synced 2025-12-21 15:35:25 +00:00
temporary fix for the toc links (also better logic for scrollArray)
This commit is contained in:
@@ -128,7 +128,8 @@ a.ltx_LaTeXML_logo:visited {
|
||||
}
|
||||
|
||||
.ltx_TOC a {
|
||||
display: block; width: 100%;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ltx_TOC {
|
||||
|
||||
@@ -8,8 +8,8 @@ function initTocOnClick() {
|
||||
coll.classList.toggle("active");
|
||||
const content = coll.nextElementSibling;
|
||||
if (content) {
|
||||
event.preventDefault(); // don't jump
|
||||
if (content.style.maxHeight) {
|
||||
event.preventDefault(); // don't jump if closing
|
||||
content.style.maxHeight = null;
|
||||
} else {
|
||||
content.style.maxHeight = content.scrollHeight + "px";
|
||||
@@ -122,8 +122,10 @@ function saveScroll() {
|
||||
|
||||
const pos = window.scrollY;
|
||||
const scrollArray = JSON.parse(sessionStorage.getItem("scrollPos") ?? "[]");
|
||||
scrollArray.unshift(pos);
|
||||
sessionStorage.setItem("scrollPos", JSON.stringify(scrollArray));
|
||||
if (scrollArray[0] !== Math.round(pos)) {
|
||||
scrollArray.unshift(Math.round(pos));
|
||||
sessionStorage.setItem("scrollPos", JSON.stringify(scrollArray));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user