Fix sidebar highlighting issue
This commit is contained in:
parent
5a94bc5dd3
commit
c67e79f894
@ -106,6 +106,7 @@ for (const entry of pagesIndex) {
|
||||
import { thp_highlighter, CodeJar } from "../lexer/highlighter";
|
||||
// Add an editor to all code samples
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const code_elements = document.querySelectorAll(".language-thp");
|
||||
|
||||
for (const e of [...code_elements]) {
|
||||
@ -122,6 +123,7 @@ for (const entry of pagesIndex) {
|
||||
tab: " ",
|
||||
}).updateCode(code);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// Highlight the current url of the sidebar
|
||||
@ -135,7 +137,8 @@ for (const entry of pagesIndex) {
|
||||
console.log(sidebar.offsetTop);
|
||||
console.log(link.offsetTop);
|
||||
|
||||
sidebar.scrollTop = link.offsetTop - sidebar.offsetTop - 250;
|
||||
sidebar.scrollTop =
|
||||
link.offsetTop - sidebar.offsetTop - 250;
|
||||
|
||||
link.classList.add("bg-pink-200", "dark:bg-pink-950");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user