Update style of collapsible list

This commit is contained in:
fechin committed 2023-02-10 14:36:46 +08:00
1 parent 92e9af0567
commit 40cdf0dc8e
2 files changed
+15 -8

No files matched your search

@@ -38,14 +38,19 @@
display: none;
}
.mdLayout .h3-wrap > .section > ul.collapsible > li.active > pre {
.mdLayout .h3-wrap > .section > ul.collapsible > li.active > pre {
display: block;
}
.mdLayout .h3-wrap > .section > ul.collapsible > li.arrow-down:before {
.mdLayout .h3-wrap > .section > ul.collapsible > li > strong:hover{
cursor: pointer;
}
.mdLayout .h3-wrap > .section > ul.collapsible > li > strong.arrow-down:before {
content: "▼"; /*▼*/
}
.mdLayout .h3-wrap > .section > ul.collapsible > li:before {
.mdLayout .h3-wrap > .section > ul.collapsible > li > strong:before {
content: "▶"; /*▼*/
position: absolute;
left: 10px;
+7 -5
View File
@@ -73,11 +73,13 @@ window.addEventListener('load', () => {
});
/******** List Collapsible ***********/
document.querySelectorAll("ul.collapsible > li").forEach(function (li) {
li.classList.add("active");
li.addEventListener("click", function () {
// this.classList.toggle("active");
// this.classList.toggle("arrow-down");
document.querySelectorAll("ul.collapsible > li > strong").forEach(function (strong) {
let li = strong.parentElement;
// li.classList.add("active");
// strong.classList.toggle("arrow-down");
strong.addEventListener("click", function () {
li.classList.toggle("active");
this.classList.toggle("arrow-down");
});
});