I currently have something like this
HTML:
.ln-header {
cursor: pointer;
}
.ln-header::after {
content: "+";
margin-left: 10px;
transition: 400ms;
}
.list-wrap {
display: none;
}
.checkbox1:checked + .list-wrap {
display: block;
}
.checkbox1:checked + .ln-header::after {
transform: rotate(45deg);
}
.checkbox1:checked + .ln-wrap::after {
transform: rotate(45deg);
}
.checkbox1 {
display: none;
}
<div>
<div>
<label for="list1" class="localnav-categories-label">
<span class="ln-header">categories</span>
</label>
<input type="checkbox" id="list1" class="checkbox1">
<nav class="list-wrap">
<ul>
<li>
<a href="#">one</a>
</li>
<li>
<a href="#">two</a>
</li>
</ul>
</nav>
</div>
</div>
I'm trying to get the plus sign (as an ::after element) to rotate, preferably with an animation, while a list pops up. Currently, I am only able to get the list to appear, while the plus sign remains static. I've heard about the checkbox only affecting its sibling element (may be wrong), but after playing around with the location, where I have it now seems to be the only place that it'll work for the list to appear.
How could I make it so that when I check the checkbox, both the list appears and the '+' rotates simultaneously?
Thanks!