1
0
forked from SPC/spc-site

Minor UI fixes

This commit is contained in:
Alexander Nozik 2023-03-27 13:39:19 +03:00
parent f61bb5cc90
commit 5f2439f42a
2 changed files with 18 additions and 8 deletions

View File

@ -2447,3 +2447,13 @@ table {
background-attachment: scroll; } }
/*# sourceMappingURL=main.css.map */
/*from https://www.w3schools.com/howto/howto_js_collapsible.asp*/
/* Style the collapsible content. Note: hidden by default */
.collapsible-content {
padding: 0 18px;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}

View File

@ -190,17 +190,17 @@
})(jQuery);
//From https://www.w3schools.com/howto/howto_js_collapsible.asp
let collapsibles = document.getElementsByClassName("collapsible");
const coll = document.getElementsByClassName("collapsible");
let i;
Array.from(collapsibles).forEach(item => {
item.addEventListener("click", function () {
this.classList.toggle("collapsible-expanded");
let target = item.attributes.getNamedItem("data-target").value;
let content = document.getElementById(target);
if (content.style.maxHeight) {
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
const content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
})
}