Merge pull request #10 from Junyi-99/fix-ToC-cannot-click

Fix to c cannot click
This commit is contained in:
Junyi 2024-03-04 19:44:51 +08:00 committed by GitHub
commit ada44ff67d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View File

@ -37,6 +37,7 @@ html {
/* 2 */ /* 2 */
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
/* 2 */ /* 2 */
scroll-behavior: smooth;
} }
body { body {

View File

@ -7,13 +7,15 @@
<script> <script>
document.querySelector(".toc").addEventListener("click", function () { document.querySelector(".toc").addEventListener("click", function () {
event.preventDefault(); if (event.target.tagName !== "A") {
if (this.open) { event.preventDefault();
this.open = false; if (this.open) {
this.classList.remove("expanded"); this.open = false;
} else { this.classList.remove("expanded");
this.open = true; } else {
this.classList.add("expanded"); this.open = true;
this.classList.add("expanded");
}
} }
}); });
</script> </script>