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; } } background-attachment: scroll; } }
/*# sourceMappingURL=main.css.map */ /*# 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); })(jQuery);
//From https://www.w3schools.com/howto/howto_js_collapsible.asp //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 => { for (i = 0; i < coll.length; i++) {
item.addEventListener("click", function () { coll[i].addEventListener("click", function() {
this.classList.toggle("collapsible-expanded"); this.classList.toggle("active");
let target = item.attributes.getNamedItem("data-target").value; const content = this.nextElementSibling;
let content = document.getElementById(target); if (content.style.maxHeight){
if (content.style.maxHeight) {
content.style.maxHeight = null; content.style.maxHeight = null;
} else { } else {
content.style.maxHeight = content.scrollHeight + "px"; content.style.maxHeight = content.scrollHeight + "px";
} }
}); });
}) }