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 {
|
.ltx_TOC a {
|
||||||
display: block; width: 100%;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ltx_TOC {
|
.ltx_TOC {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ function initTocOnClick() {
|
|||||||
coll.classList.toggle("active");
|
coll.classList.toggle("active");
|
||||||
const content = coll.nextElementSibling;
|
const content = coll.nextElementSibling;
|
||||||
if (content) {
|
if (content) {
|
||||||
event.preventDefault(); // don't jump
|
|
||||||
if (content.style.maxHeight) {
|
if (content.style.maxHeight) {
|
||||||
|
event.preventDefault(); // don't jump if closing
|
||||||
content.style.maxHeight = null;
|
content.style.maxHeight = null;
|
||||||
} else {
|
} else {
|
||||||
content.style.maxHeight = content.scrollHeight + "px";
|
content.style.maxHeight = content.scrollHeight + "px";
|
||||||
@@ -122,8 +122,10 @@ function saveScroll() {
|
|||||||
|
|
||||||
const pos = window.scrollY;
|
const pos = window.scrollY;
|
||||||
const scrollArray = JSON.parse(sessionStorage.getItem("scrollPos") ?? "[]");
|
const scrollArray = JSON.parse(sessionStorage.getItem("scrollPos") ?? "[]");
|
||||||
scrollArray.unshift(pos);
|
if (scrollArray[0] !== Math.round(pos)) {
|
||||||
sessionStorage.setItem("scrollPos", JSON.stringify(scrollArray));
|
scrollArray.unshift(Math.round(pos));
|
||||||
|
sessionStorage.setItem("scrollPos", JSON.stringify(scrollArray));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user