fix a bug in toc selector
This commit is contained in:
parent
cf18ae777f
commit
3cd15e9a35
@ -17,16 +17,19 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.querySelector(".toc").addEventListener("click", function () {
|
var toc = document.querySelector(".toc");
|
||||||
if (event.target.tagName !== "A") {
|
if (toc) {
|
||||||
event.preventDefault();
|
toc.addEventListener("click", function () {
|
||||||
if (this.open) {
|
if (event.target.tagName !== "A") {
|
||||||
this.open = false;
|
event.preventDefault();
|
||||||
this.classList.remove("expanded");
|
if (this.open) {
|
||||||
} else {
|
this.open = false;
|
||||||
this.open = true;
|
this.classList.remove("expanded");
|
||||||
this.classList.add("expanded");
|
} else {
|
||||||
|
this.open = true;
|
||||||
|
this.classList.add("expanded");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user