Categories
<style>
ul, #myUL {
list-style-type: disc;
}
#myUL {
margin: 0;
padding: 0;
}
.caret {
/* cursor: pointer;*/
-webkit-user-select: none; /* Safari 3.1+ */
-moz-user-select: none; /* Firefox 2+ */
-ms-user-select: none; /* IE 10+ */
user-select: none;
}
.caret::before {
content: "\25B6";
color: black;
display: inline-block;
margin-right: 6px;
}
.caret-down::before {
-ms-transform: rotate(90deg); /* IE 9 */
-webkit-transform: rotate(90deg); /* Safari */
transform: rotate(90deg);
}
.nested {
display: block;
}
.active {
display: block;
}
</style>
<ul id="myUL">
<li><span><a href="https://experihub.com/discussions/category/physics/">Physics</a></span>
<ul class="nested">
<li><a href="https://experihub.com/discussions/category/physics/electricity-magnetism/">Electricity & Magnetism</a></li>
<li><a href="https://experihub.com/discussions/category/physics/light/">light</a></li>
<li><a href="https://experihub.com/discussions/category/physics/heat/">Heat</a></li>
<li><a href="https://experihub.com/discussions/category/physics/quantum-physics/">Quantum Physics</a></li>
<li><a href="https://experihub.com/discussions/category/physics/sound/">Sound</a></li>
<li><a href="https://experihub.com/discussions/category/physics/force/">Force</a></li>
<li><a href="https://experihub.com/discussions/category/physics/heat/">Heat</a></li>
</ul>
</li>
</ul>
<ul id="myUL">
<li><span><a href="https://experihub.com/discussions/category/chemistry/">Chemistry</a></span>
<ul class="nested">
<li><a href="https://experihub.com/discussions/category/chemistry/chemical-reactions/">Chemical Reactions</a></li>
<li><a href="https://experihub.com/discussions/category/chemistry/elements-in-periodic-table/">Elements in Periodic Table</a></li>
</ul>
</li>
</ul>
<ul id="myUL">
<li><span><a href="https://experihub.com/discussions/category/biology/">Biology</a></span>
<ul class="nested">
<li><a href="https://experihub.com/discussions/category/biology/human-body/">Human Body</a></li>
<li><a href="https://experihub.com/discussions/category/biology/plant/">Plants</a></li>
</ul>
</li>
</ul>
<ul id="myUL">
<li><span><a href="https://experihub.com/discussions/category/environmental-studies/">Environmental Studies</a></span>
<ul class="nested">
<li><a href="https://experihub.com/discussions/category/environmental-studies/soil/">Soil</a></li>
<li><a href="https://experihub.com/discussions/category/environmental-studies/pollution/">Pollution</a></li>
</ul>
<ul id="myUL">
<li><span><a href="https://experihub.com/discussions/category/stem-in-real-life/">Stem in Real Life</a></span>
<ul class="nested">
<li><a href="https://experihub.com/discussions/category/finance-101/">Finance 101</a></li>
</ul>
</li>
</ul>
<script>
var toggler = document.getElementsByClassName("caret");
var i;
for (i = 0; i < toggler.length; i++) {
toggler[i].addEventListener("click", function() {
this.parentElement.querySelector(".nested").classList.toggle("active");
this.classList.toggle("caret-down");
});
}
</script>
[dwqa-list-questions]