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 */
-webkit-text-size-adjust: 100%;
/* 2 */
scroll-behavior: smooth;
}
body {

View File

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