I understand that other people have asked questions similar to this, and I've already looked through their answers from other users and still am having difficulty understanding what to do...
Currently on one of the pages on my website, all of the collapsible content is automatically shown and will hide when you click on it. I would like the opposite, where all of the collapsible content is by default hidden, and you would have to click on the collapsible content to view the nested content inside of it to be shown.
Here is my CSS:
body{
display: block;
}
li{
list-style-type: none;
text-align:left;
padding:3.5px;
position:relative;
}
.hhhh{
text-align:left;
}
h2{
text-align:center;
}
h7{
font-size:15px;
}
span{
text-align:left;
}
And here is my HTML:
<body>
<h2>Industries Served</h2>
<div id="ListContainer">
<ul id="expList">
<li>
<h7 style="font-family:14px">
<i class="fa fa-caret-right"></i> Aerospace & Aeronautics
</h7>
<ul>
<li>
<div>
<div>
<p class="alert"> ......... </p>
</div>
</div>
</li>
</ul>
</li>
<li>
<h7>
Agriculture & Food Science
</h7>
<ul>
<li>
<div>
<p> ......... </p>
</div>
</li>
</ul>
</li>
<li>
<h7>
Alternative Energy & Clean Technology
</h7>
<ul>
<li>
<div>
<p> ......... </p>
</div>
</li>
</ul>
</li>
</ul>
</div>
Here is my javascript:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.markdown-block .sqs-block-content h7').css('cursor','pointer');
$(".markdown-block .sqs-block-content h7").click(function(){
$(this).nextUntil("h7").slideToggle()
$(this).find('.fa-caret-right').toggleClass('fa-rotate-90');
});
});
Thank you!