I have a CSS accordion that I would like to close each panel upon clicking. Can this be accomplished using only CSS, or will JavaScript need to be added?
#accordion input:not(:checked) + div {
display: none;
}
#accordion input:checked + div {
display: block;
}
#accordion input {
width: 0px;
height: 0px;
margin: 0px;
opacity: 0.0;
}
#accordion label {
cursor: pointer;
display: inline-block;
width: 750px;
background: #ffffff;
color: #ff6600;
font-family: open sans;
border: 1px solid #ff6600;
font-size: 24px;
padding: 25px 20px;
margin: 0px;
}
#accordion div {
width: 750px;
background: white;
border: 1px solid gray;
padding: 15px 20px;
}
#accordion li {
list-style: none;
}
div.scroll {
max-height: 1050px;
overflow: auto;
}
.timely-stream:not(.timely-agenda) .timely-event {
min-height:92px; !important
}
<ul id="accordion">
<li>
<label for="section-1-checkbox">OneHockey</label>
<input id="section-1-checkbox" type="radio" name="accordion-level-1" />
<div><a href="https://imgur.com/HJwXuym"><img
src="https://i.imgur.com/HJwXuym.png?1" width="750px" height="422px"
title="source: imgur.com" /></a></div>
</li>
<li>
<label for="section-2-checkbox">TOURNAMENTS</label>
<input id="section-2-checkbox" type="radio" name="accordion-level-1" />
<div class="scroll">
<script src="//dashboard.time.ly/js/embed.js" data-
src="https://events.time.ly/hye2ww2?categories=21029&organizers=43496"
data-max-height="0" id="timely_script" class="timely-script"></script>
</div>
</li>
<li>
<label for="section-3-checkbox">INFO</label>
<input id="section-3-checkbox" type="radio" name="accordion-level-1" />
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</li>
<li>
<label for="section-4-checkbox">STANDINGS/SCHEDULE</label>
<input id="section-4-checkbox" type="radio" name="accordion-level-1" />
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</li>
</ul>