diff --git a/assets/css/main.css b/assets/css/main.css index 7552cf3..69bc2a9 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -491,3 +491,28 @@ pre code { text-decoration: none; padding: 1 5px; } + + /* Open and close the collapsible content button */ + .collapsible { + background-color: #eee; + color: #444; + cursor: pointer; + padding: 18px; + width: 100%; + border: none; + text-align: left; + outline: none; + font-size: 15px; +} + +.active, .collapsible:hover { + background-color: #ccc; +} + +/* 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; +} diff --git a/assets/js/collapsible.js b/assets/js/collapsible.js new file mode 100644 index 0000000..94e925d --- /dev/null +++ b/assets/js/collapsible.js @@ -0,0 +1,14 @@ +var coll = document.getElementsByClassName("collapsible"); +var i; + +for (i = 0; i < coll.length; i++) { + coll[i].addEventListener("click", function() { + this.classList.toggle("active"); + var content = this.nextElementSibling; + if (content.style.maxHeight){ + content.style.maxHeight = null; + } else { + content.style.maxHeight = content.scrollHeight + "px"; + } + }); +} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 7f33e52..06d3fbb 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,12 +1,17 @@ - {{- partial "head.html" . }} - {{ partial "head-custom.html" . -}} -
-